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">
|
<sect1 xml:id="adding-swap-space">
|
||||||
<title>Adding Swap Space</title>
|
<title>Adding Swap Space</title>
|
||||||
|
|
||||||
<para>Sometimes a system requires more swap space. There are
|
<para>Sometimes a system requires more swap space. This section
|
||||||
three ways to increase swap space: add a new hard drive,
|
describes two methods to increase swap space: adding swap to an
|
||||||
enable swap over <literal>NFS</literal>, or create a swap file
|
existing partition or new hard drive, and creating a swap file
|
||||||
on an existing partition.</para>
|
on an existing partition.</para>
|
||||||
|
|
||||||
<para>For information on how to encrypt swap space, which options
|
<para>For information on how to encrypt swap space, which options
|
||||||
|
@ -2713,16 +2713,16 @@ kern.maxvnodes: 100000</screen>
|
||||||
<xref linkend="swap-encrypting"/>.</para>
|
<xref linkend="swap-encrypting"/>.</para>
|
||||||
|
|
||||||
<sect2 xml:id="new-drive-swap">
|
<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
|
<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
|
partitions and hard drives is explained in
|
||||||
<xref linkend="disks-adding"/> while
|
<xref linkend="disks-adding"/> while
|
||||||
<xref linkend="configtuning-initial"/> discusses partition
|
<xref linkend="configtuning-initial"/> discusses partition
|
||||||
layouts and swap partition size considerations.</para>
|
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>
|
For example:</para>
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>swapon <replaceable>/dev/ada1s1b</replaceable></userinput></screen>
|
<screen>&prompt.root; <userinput>swapon <replaceable>/dev/ada1s1b</replaceable></userinput></screen>
|
||||||
|
@ -2730,10 +2730,10 @@ kern.maxvnodes: 100000</screen>
|
||||||
<warning>
|
<warning>
|
||||||
<para>It is possible to use any partition not currently
|
<para>It is possible to use any partition not currently
|
||||||
mounted, even if it already contains data. Using
|
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
|
overwrite and destroy that data. Make sure that the
|
||||||
partition to be added as swap is really the intended
|
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>
|
</warning>
|
||||||
|
|
||||||
<para>To automatically add this swap partition on boot, add an
|
<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>
|
<programlisting><replaceable>/dev/ada1s1b</replaceable> none swap sw 0 0</programlisting>
|
||||||
|
|
||||||
<para>See &man.fstab.5; for an explanation of the entries in
|
<para>See &man.fstab.5; for an explanation of the entries in
|
||||||
<filename>/etc/fstab</filename>.</para>
|
<filename>/etc/fstab</filename>. More information about
|
||||||
</sect2>
|
<command>swapon</command> can be found in
|
||||||
|
&man.swapon.8;.</para>
|
||||||
<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>
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 xml:id="create-swapfile">
|
<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
|
example creates a 64MB file named
|
||||||
<filename>/usr/swap0</filename>.</para>
|
<filename>/usr/swap0</filename>.</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Creating a Swapfile on &os;</title>
|
<title>Creating a Swap File on &os;</title>
|
||||||
|
|
||||||
<orderedlist>
|
<orderedlist>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>The <filename>GENERIC</filename> kernel already
|
<para>The <filename>GENERIC</filename> kernel already
|
||||||
includes the memory disk driver (&man.md.4;) required
|
includes the required memory disk driver.
|
||||||
for this operation. When building a custom kernel,
|
When building a custom kernel,
|
||||||
make sure to include the following line in the custom
|
make sure to include the following line in the custom
|
||||||
configuration file:</para>
|
configuration file:</para>
|
||||||
|
|
||||||
|
@ -2780,31 +2772,33 @@ kern.maxvnodes: 100000</screen>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>First, create the swapfile
|
<para>Create the swap file,
|
||||||
<filename>/usr/swap0</filename>:</para>
|
<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>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Then, set proper permissions on
|
<para>Then, set proper permissions on
|
||||||
<filename>/usr/swap0</filename>:</para>
|
<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>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Enable the swap file in
|
<para>Enable the swap file in
|
||||||
<filename>/etc/rc.conf</filename>:</para>
|
<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>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Reboot the machine or, to enable the swap file
|
<para>To enable the swap file
|
||||||
immediately, type:</para>
|
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>
|
</listitem>
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
</example>
|
</example>
|
||||||
|
|
Loading…
Reference in a new issue