Setting Up a RAIDZ2 File Server With Snapshots on FreeNAS
After installing a baseline FreeNAS installation, the spare drives must be configured. This tutorial will cover using 4x hard disks to create a RAIDZ2, which is the ZFS equivalent to RAID6 with 2 parity disks. This will allow for 2 drive to fail simultaneously while retaining data integrity.
Create RAIDZ2 Volume¶
RAIDZ2: double-parity ZFS software solution that is similar to RAID-6. It also avoids the write-hole and does not require any special hardware, meaning it can be used on commodity disks. RAIDZ2 allows you to lose one drive without any degradation as it basically becomes a RAIDZ1 until you replace the failed drive and restripe. At this time, RAIDZ2 on FreeBSD is slower than RAIDZ1.
Once logged into the FreeNAS admin panel go to . Now give the volume a name, this example uses the name corefiles. Then in the Volume Layout, drag the slider to add the 4 storage hard disks; the Volume Layout will automagically choose the optimal layout for using 4 disks, which is RAIDZ2. This can be overridden, however that is beyond the scope of this guide. Once the configuration is finished, click Add Volume. This will create the mount point
/mnt/corefiles on FreeNAS, this is where the file server will be service files from.
Create Windows File Server¶
Currently, Windows CIFS file sharing protocol is the dominant (albeit inferior to NFS over SSH) file serving protocol.Once logged into the FreeNAS admin panel go to . This guide will use the following settings:
- Name: corefiles
- Comment: Windows Core File Server
- Path: /mnt/corefiles
- Browsable to Network Clients: [X]
When the configuration is completed, click Ok. When asked "Would you like to enable this service?", click Yes.
Create Periodic Snapshot¶
One of the many awesome features of ZFS is periodic snapshots. This feature provides a clever way of keeping a history of files, should you need to recover an older copy or even a deleted file.Once logged into the FreeNAS admin panel go to . This guide uses the following configuration:
- Volume/Dataset: corefiles
- Lifetime: 2 Year(s)
- Interval: 15 Minutes
At this point a Windows File Server has been setup, with periodic snapshots every 15 minutes for 2 years and RAIDZ2 level fault tolerance. This can all done on commodity hardware, no special RAID controller needed.