FreeNAS – Setting up ZFS

I always was curious about ZFS but haven’t played with it until very recently. I thought it was too complicated and I was afraid it will use up too much space because of the snapshots capability.

Few days ago I installed the latest beta of FreeNAS 8 on a USB stick (here how it is done) and decided to give a try to ZFS finally.

I use an old laptop and 120GB USB hard-drive. The goal is to create the file system (ZFS) and some Windows (CIFS) shares on top of it that will be available for data storage on my local network.

I will start with creating a group (HomeUsers) and user (john). These will be used later when setting the shares owner. The next two screen-shots show just that:

The newly created group is associated with the user (through the Members button).:

The next step is to create the file system on the USB hard-disk. From the left navigation expand Storage -> Volumes and click on Volume Manager. This will show a pop-up where you type the volume name, select the disk (in this case ada0), the file system type (ZFS) and click Add Volume button:

This will also automatically create a ZFS Scrub for the volume. ZFS has a repair tool called “scrub” which examines and repairs Silent Corruption and other problems. The default interval between consecutive runs is 35 days.

With the new ZFS volume in place you can create either ZFS Volume or ZFS Dataset.

A zvol (ZFS volume) is a feature of ZFS that creates a device block over ZFS. This allows you to use a zvol as an iSCSI device extent for example.

In contrast ZFS datasets allow for more granularity when configuring which users have access to which data. A dataset is similar to a folder in that you can set permissions; it is also similar to a filesystem in that you can set quotas and compression.

NOTE: if your goal is to share an entire ZFS volume, you don’t have to create datasets. If you wish to divide up a ZFS volume’s data into different shares, create a dataset for each share.

The next screen-shot shows creation of a dataset named Backup:

Let’s set the permissions for the new dataset from Storage -> View Volumes -> Change Permissions:

The next thing will be to set up a periodic snapshot for the ZFS volume. The lifetime will be 2 weeks, it will run between 9:00 and 18:00 every hour from Monday to Friday:

Having a periodic snapshots is like having a time machine – you can go back and restore the data to a previous state. This is illustrated in the next article

Tagged with: ,