Recent articles (showing 11-20 out of 69):
Configuring a swap file in FreeBSD 10 changed to handle some internal issues and race conditions.
Swapfiles are useful if you need to add extra swap space to an existing installation, or if you want to add swap space protected by ZFS pools.
First, create the swapfile on the disk. In the example below, i'm creating a 4GB swapfile called /swapfile.dat:
dd if=/dev/zero of=/swapfile.dat bs=1m count=4096
chmod 0600 /swapfile.dat Copy
Now we've created the swapfile, we need to tell FreeBSD to mount it on startup.
Edit (or create) your /etc/fstab file with your favourite editor, and add the following line:
md99 none swap sw,file=/swapfile.dat 0 0 Copy
This will instruct the boot sequence to create a pseudo node called /dev/md99 which will be mapped to /swapfile.dat and mounted as swap.
If you wanted multiple swapfiles (perhaps on multiple pools), repeat the above steps and change the md99 to md98 etc. for each swapfile.