FreeBSD 10 won't add swap file

I was following the instructions in the handbook. I have a swap file, and it is set to 0600 permissions. I also added this line to fstab:

Code:
md99    none    swap    sw,file=/swap   0       0

Running swapon -aq returns with exit status 0, and no error message. The swap file is not mounted. Any ideas?
 
How was the swap created? (If it is a sparse file, expect problems.) How big is it, and who owns it?
 
Tested here, and it does not mount the swap file unless the -L option is given ( swapon -aL) This should only be needed for /etc/fstab swap entries marked as "late". But I'm sure this worked when I wrote those swapfile instructions, so this is a regression. Please enter a bug report at https://bugs.freebsd.org/bugzilla/.
 
Hi there. I've just installed 10.1-RELEASE and had the exact same issue.

Code:
FreeBSD fbsdg-1 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

Code:
% cat /etc/fstab 
# Device    Mountpoint    FStype    Options            Dump    Pass#
/dev/ada0a    /        ufs    rw            1    1
md99        none        swap    sw,file=/usr/swap0,late    0    0
 
I can confirm that the issue is still present in 10.2. swapon -aL mounts the file but after reboot it's not present. I tried both md99 and md42.
 
A temporary workaround while this gets fixed is to put the swap line in a separate fstab file and mount it manually in rc.local:

Code:
echo "md99 none swap sw,file=/usr/swap0 0 0" >> /etc/fstab_fix
echo "swapon -F /etc/fstab_fix -aL" > /etc/rc.local
 
Back
Top