Editorial review of Swap Space section.
This really belongs in the Storage chapter and should have a reference for ZFS swap. Sponsored by: iXsystems
This commit is contained in:
parent
eeab0ad3a5
commit
44cc58d407
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44770
1 changed files with 25 additions and 31 deletions
|
@ -2703,9 +2703,9 @@ kern.maxvnodes: 100000</screen>
|
|||
<sect1 xml:id="adding-swap-space">
|
||||
<title>Adding Swap Space</title>
|
||||
|
||||
<para>Sometimes a system requires more swap space. There are
|
||||
three ways to increase swap space: add a new hard drive,
|
||||
enable swap over <literal>NFS</literal>, or create a swap file
|
||||
<para>Sometimes a system requires more swap space. This section
|
||||
describes two methods to increase swap space: adding swap to an
|
||||
existing partition or new hard drive, and creating a swap file
|
||||
on an existing partition.</para>
|
||||
|
||||
<para>For information on how to encrypt swap space, which options
|
||||
|
@ -2713,16 +2713,16 @@ kern.maxvnodes: 100000</screen>
|
|||
<xref linkend="swap-encrypting"/>.</para>
|
||||
|
||||
<sect2 xml:id="new-drive-swap">
|
||||
<title>Swap on a New or Existing Hard Drive</title>
|
||||
<title>Swap on a New Hard Drive or Existing Partition</title>
|
||||
|
||||
<para>Adding a new hard drive for swap gives better performance
|
||||
than adding a partition on an existing drive. Setting up
|
||||
than using a partition on an existing drive. Setting up
|
||||
partitions and hard drives is explained in
|
||||
<xref linkend="disks-adding"/> while
|
||||
<xref linkend="configtuning-initial"/> discusses partition
|
||||
layouts and swap partition size considerations.</para>
|
||||
|
||||
<para>Use &man.swapon.8; to add a swap partition to the system.
|
||||
<para>Use <command>swapon</command> to add a swap partition to the system.
|
||||
For example:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>swapon <replaceable>/dev/ada1s1b</replaceable></userinput></screen>
|
||||
|
@ -2730,10 +2730,10 @@ kern.maxvnodes: 100000</screen>
|
|||
<warning>
|
||||
<para>It is possible to use any partition not currently
|
||||
mounted, even if it already contains data. Using
|
||||
&man.swapon.8; on a partition that contains data will
|
||||
<command>swapon</command> on a partition that contains data will
|
||||
overwrite and destroy that data. Make sure that the
|
||||
partition to be added as swap is really the intended
|
||||
partition before running &man.swapon.8;.</para>
|
||||
partition before running <command>swapon</command>.</para>
|
||||
</warning>
|
||||
|
||||
<para>To automatically add this swap partition on boot, add an
|
||||
|
@ -2742,34 +2742,26 @@ kern.maxvnodes: 100000</screen>
|
|||
<programlisting><replaceable>/dev/ada1s1b</replaceable> none swap sw 0 0</programlisting>
|
||||
|
||||
<para>See &man.fstab.5; for an explanation of the entries in
|
||||
<filename>/etc/fstab</filename>.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="nfs-swap">
|
||||
<title>Swapping over <literal>NFS</literal></title>
|
||||
|
||||
<para>Swapping over <literal>NFS</literal> is only recommended
|
||||
when there is no local hard disk to swap to.
|
||||
<literal>NFS</literal> swapping will be limited by the
|
||||
available network bandwidth and puts an additional burden
|
||||
on &man.nfsd.8;.</para>
|
||||
<filename>/etc/fstab</filename>. More information about
|
||||
<command>swapon</command> can be found in
|
||||
&man.swapon.8;.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="create-swapfile">
|
||||
<title>Swapfiles</title>
|
||||
<title>Creating a Swap File</title>
|
||||
|
||||
<para>To create a swap file, specify its size. The following
|
||||
<para>To instead create a swap file, specify its size. The following
|
||||
example creates a 64MB file named
|
||||
<filename>/usr/swap0</filename>.</para>
|
||||
|
||||
<example>
|
||||
<title>Creating a Swapfile on &os;</title>
|
||||
<title>Creating a Swap File on &os;</title>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>The <filename>GENERIC</filename> kernel already
|
||||
includes the memory disk driver (&man.md.4;) required
|
||||
for this operation. When building a custom kernel,
|
||||
includes the required memory disk driver.
|
||||
When building a custom kernel,
|
||||
make sure to include the following line in the custom
|
||||
configuration file:</para>
|
||||
|
||||
|
@ -2780,31 +2772,33 @@ kern.maxvnodes: 100000</screen>
|
|||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>First, create the swapfile
|
||||
<para>Create the swap file,
|
||||
<filename>/usr/swap0</filename>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>dd if=/dev/zero of=/usr/swap0 bs=1024k count=64</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>dd if=/dev/zero of=<replaceable>/usr/swap0</replaceable> bs=1024k count=<replaceable>64</replaceable></userinput></screen>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Then, set proper permissions on
|
||||
<filename>/usr/swap0</filename>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>chmod 0600 /usr/swap0</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>chmod 0600 <replaceable>/usr/swap0</replaceable></userinput></screen>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Enable the swap file in
|
||||
<filename>/etc/rc.conf</filename>:</para>
|
||||
|
||||
<programlisting>swapfile="/usr/swap0" # Set to name of swapfile if aux swapfile desired.</programlisting>
|
||||
<programlisting>swapfile="<replaceable>/usr/swap0</replaceable>" # Set to name of swap file</programlisting>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Reboot the machine or, to enable the swap file
|
||||
immediately, type:</para>
|
||||
<para>To enable the swap file
|
||||
immediately, specify a free memory device. Refer to
|
||||
<xref linkend="disks-virtual"/> for more information
|
||||
about memory devices.</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f /usr/swap0 -u 0 && swapon /dev/md0</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>mdconfig -a -t vnode -f <replaceable>/usr/swap0</replaceable> -u <replaceable>0</replaceable> && swapon /dev/md<replaceable>0</replaceable></userinput></screen>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</example>
|
||||
|
|
Loading…
Reference in a new issue