By following the relevant section of the handbook (https://www.freebsd.org/doc/handbook/adding-swap-space.html) I created a swap file and set up fstab: dd if=/dev/zero of=/usr/swap0 bs=1m count=2048 chmod 0600 /usr/swap0 echo "md99 none swap sw,file=/usr/swap0 0 0" >> /etc/fstab Now, running "swapon -aL" does indeed mount the swap file. The problem is that after reboot, the swap file is not mounted, and running "swapon -aL" returns the following error: "md99 on /usr/swap0: Device already in use" I found a thread in the forum, which confirms that this is present in 10.0 and 10.1: https://forums.freebsd.org/threads/freebsd-10-wont-add-swap-file.47167/ Upon asking on IRC, it was confirmed that it is a bug and it's recommended that a bug ticket should be created for this.
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: echo "md99 none swap sw,file=/usr/swap0 0 0" >> /etc/fstab_fix echo "swapon -F /etc/fstab_fix -aL" > /etc/rc.local
Just add "late" to the mount options. This is not properly documented.
Duplicate of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=181565
*** This bug has been marked as a duplicate of bug 181565 ***