From c4048ad51113e98db9cef1de12fcf8c4baff1541 Mon Sep 17 00:00:00 2001 From: Michael Lucas Date: Tue, 22 Jan 2002 18:39:14 +0000 Subject: [PATCH] Swap space management is part of system configuration and tuning, so put information about adding swap space to the end of this chapter. Text taken from the FAQ, with minor glue to Handbook-ize it. --- .../books/handbook/config/chapter.sgml | 86 ++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/en_US.ISO8859-1/books/handbook/config/chapter.sgml b/en_US.ISO8859-1/books/handbook/config/chapter.sgml index ae66aae91a..0fe003f4bc 100644 --- a/en_US.ISO8859-1/books/handbook/config/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/config/chapter.sgml @@ -161,7 +161,7 @@ - + Swap Partition swap sizing @@ -1112,6 +1112,90 @@ kern.maxfiles: 2088 -> 5000 to multiply by 2, so 32MBx2 = 64MB/2K = 32768. + + + Adding Swap Space + + No matter how well you plan, sometimes a system doesn't run + as you expect. If you find you need more swap space, it's + simple enough to add. You have three ways to increase swap + space: adding a new hard drive, enabling swap over NFS, and + creating a swap file on an existing partition. + + + Swap on a New Hard Drive + + The best way to add swap, of course, is to use this as an + excuse to add another hard drive. You can always use another + hard drive, after all. If you can do this, go reread the + discussion of swap space + from the Initial Configuration + section of the Handbook for some suggestions on how to best + arrange your swap. + + + + Swapping over NFS + + Swapping over NFS is only recommended if you do not have a + local hard disk to swap to. Swapping over NFS is slow and + inefficient in versions of FreeBSD prior to 4.x. It is + reasonably fast and efficient in 4.0-RELEASE and newer. Even + with newer versions of FreeBSD, NFS swapping will be limited + by the available network bandwidth and puts an additional + burden on the NFS server. + + + + Swapfiles + + You can create a file of a specified size to use as a swap + file. In our example here we will use a 64Mb file called + /usr/swap0. You can use any name you + want, of course. + + First, be certain that your kernel configuration includes + the vnode driver. It is not in recent versions of + GENERIC. + + pseudo-device vn 1 #Vnode driver (turns a file into a device) + + + + create a vn-device + &prompt.root; cd /dev &prompt.root; sh MAKEDEV vn0 + + + + create a swapfile (/usr/swap0) + + &prompt.root; dd if=/dev/zero of=/usr/swap0 bs=1024k count=64 + + + + set proper permissions on (/usr/swap0) + + &prompt.root; chmod 0600 /usr/swap0 + + + + enable the swap file in /etc/rc.conf + + swapfile="/usr/swap0" # Set to name of swapfile if aux swapfile desired. + + + + reboot the machine + + + + To enable the swap file immediately, type + + &prompt.root; vnconfig -e /dev/vn0b /usr/swap0 swap + +