Using a swap file

Rostislav Krasny rosti.bsd at gmail.com
Fri Oct 25 12:50:10 UTC 2013


Hi there,

I've 10.0-BETA1 i386 installed and I want to use a swap file instead
of a swap partition. I created /swapfile and I'm able to enable it
manually by following commands:

mdconfig -a -t vnode -f /swapfile -u 0
swapon /dev/md0

This is according to the following section of the Handbook:

http://www.freebsd.org/doc/handbook/adding-swap-space.html

It still states that adding swapfile="<path to swapfile>" into
/etc/rc.conf enables that swap file during a boot automatically.
However this is already not true for CURRENT and for the upcoming 10.0
release. According to following commit number 252310 this rc.conf
parameter is obsolete

http://svnweb.freebsd.org/base?view=revision&revision=252310

It introduces different configuration and offers to add a line like
following into /etc/fstab

md    none    swap    sw,file=/swapfile       0       0

This is what I did but 'swapon -a' still doesn't work. I didn't try to
reboot because I build world in other console. But I believe the
result will be the same, because /etc/rc.d/swap runs the same command:
'/sbin/swapon -aq'. So what is the right way to enable a swap file
during a boot and for commands like 'swapon -a' ?

Thanks

P.S. The Handbook needs to be updated


More information about the freebsd-current mailing list