Setup swapfile on FreeBSD

$ dd if=/dev/zero of=/swapfile bs=1m count=512
$ chmod 0600 /swapfile
$ echo ‘md99            none            swap sw,file=/swapfile  0 0’ >> /etc/fstab
$ reboot
$ swapon -aLq
$ swapinfo
$ swapctl -lh

Links: