Lampros - Weird Bricks

Quick note on adding SWAP space to FreeBSD 10

27 December, 2014 | Atlantic.net

I recently started playing with the cloud services that atlantic.net is providing which include FreeBSD 10.0.

I'm generally very happy with the service (a review coming at a later time) but one minor issue I had was the lack of swap space.

I tried following the instructions here but they didn't work for me.

A couple of minutes later a Google Search brought me here -- the following are the quick notes to get swap working:

1. Create a 128MB swap file:

dd if=/dev/zero of=/usr/swap0 bs=1m count=128

2. Add an entry to /etc/fstab:

echo 'md99    none    swap    sw,file=/usr/swap0,late 0       0' >> /etc/fstab

3. Turn swap on:

swapon -aL

4. Check SWAP usage:

swapinfo -m

Sample output:

swapinfo -m
Device          1M-blocks     Used    Avail Capacity
/dev/md99             128       11      116     9%