Intro
NAS4Free (http://www.nas4free.org/) is a free, simple to use NAS (Network Attached Storage) system with convenient web interface. I've been using NAS4Free for quite some time and have been quite happy with it. The system (still) has a couple minor glitches so I'll be posting several articles on how to overcome those.NAS4Free has some history by now. The project used to be called FreeNAS until version 0.7.x, when a company called iXsystems acquired FreeNAS name and created a completely different version called FreeNAS 8.x (available at http://www.freenas.org/). The original code is now being developed under a new name, which is NAS4Free. It is based on FreeBSD and supports ZFS, which is a very advanced file system originally developed by Sun Microsystems for Solaris OS.
So we start with this post on how to configure swap on a ZFS pool in NAS4Free.
Enabling Swap on ZFS
ZFS support in NAS4Free is quite stable. One of the minor glitches that I came across is that you cannot enable a swap partition (or file) on a ZFS pool. So here's a way to overcome it:
- Create a volume on your existing ZFS pool. This will create a separate device node and will also allow you to specify the size of the swap volume. To create a ZFS volume go to Disks -> ZFS -> Volumes and click on the + sign:
- Create a PostInit Command Script (go to System -> Advanced -> Command scripts) as follows:
/sbin/swapon /dev/zdev/pool1/swap
This assumes your ZFS pool is called pool1 and that you named the volume you created in the previous step swap. Don't forget to set Type to PostInit:
That's it. Reboot your NAS4Free system and check the status of your swap volume by going to Status -> System - look under Swap usage.