After mucking around with my Pi for some time with the aim of creating a cheap low powered NAS server. I decided I would just build one using FreeNAS so I could finally organise all my files which have been in a mess since my laptop died during my university thesis.
After some reading I set the following requirements for my system:
  • Must provide data redundancy and be able to replace a drive should one fail.
  • Must be easily expandable
  • Preferably be cost effective when compared to an off the shelf product such as Synology’s DS214+
After reading some blogs and other peoples experiences I decided not to go with the mini-ITX form factor as I was having trouble getting a board and found it to be more costly and less scalable. My system would probably be more comparable to the one here.
My Build:
To begin with I looked at both Intel and AMD motherboards meeting the following:
  • >= 6 SATA ports
  • Onboard gigabyte ethernet
  • Integrated video
  • Support a minimum of 16GB RAM, preferably four slots giving 32GB
  • Boot from USB
The two main sites I looked at where pccasegear.com and msy.com.au. Unfortunately ITX boards didn’t seem a great option so I modified my requirements and went with mini-ATX instead (making my tower cheaper and more expandable).

Once I had a good range of motherboards I looked at the combined price once a CPU was added. In the end I chose the following components:


Storage:

For storage I wanted to keep prices down but also provide data redundancy. These seemed to be my options:

“For two disks, you want mirror mode. This will cause the drives to be exact images of each other. If ZFS tries to read a block of data from the drive and it fails verification, then ZFS will automatically try to repair it. If the repair fails, it’ll read it from the other drive and mark the bad drive as failed. You should get a notification that a drive failed, but the filesystem will still be usable. You get some read speed improvements, but no write speed improvements. As long as you have at least one drive from a mirror set, you have all of your data.

With raidz, you need at least three drives. They function similar to RAID5 where (effectively) one drive stores recovery information, and the other drives store data. It can handle any drive failing, as long as only one drive fails at a time.

raidz2 and raidz3 are the same as raidz, except that they can handle two or three drives failing, respectively. They require more drives to operate and reduce effective capacity, though.”

I decided to go with two drives and mirror them.

How Much RAM?:

I needed a lot of RAM – “For systems with large disk capacity (greater than 8 TB), a general rule of thumb is 1 GB of RAM for every 1 TB of storage” – So I purchased 16GB which would give me plenty of room for any upgrades.

OS on a Flash Drive:

I also purchased a 16gb Sandisk Cruzer Fit from Ebay which would house the FreeNAS operating system.

I decided to reuse one of the cases I had lying around to begin with, and if I increased the number of drives could upgrade to a case with more drive bays at the same time.

Setting Up:

I grabbed an old computer, stole its case and fitted the new motherboard, CPU and RAM. I connected the power switch and fired it up. Success, I got the expected BIOS screen complaining about keyboard and what not.

I grabbed the FreeNAS USB image from here and wrote it to my Cruzer Fit flash drive. I booted to make sure it worked and then installed my two 3TB hard drives. After modifying the default boot order in the BIOS and connecting a Ethernet cable I was ready to play with FreeNAS.

Your FreeNAS box will be running headless so we will be connecting to it from another computer. To get the IP address you can connect a monitor or connect to your router. I connected to our router to get the IP and configured a static IP whilst I was there.

Expected screen if you connect a monitor to your NAS box.


You can now enter the IP address into the browser of your choice from a computer connected to the same network. Well then want to configure a number of things…

FreeNAS Preparation:

Set the Root Password:

The first time you access the FreeNAS® administrative interface, a pop-up window will prompt you to set the root password. You should set a hard to guess password as anyone who knows this password can gain access to the FreeNAS® administrative GUI.

NOTE: for security reasons, the SSH service and root SSH logins are disabled by default. Unless these are set, the only way to access a shell as root is to gain physical access to the console menu or to access the web shell within the administrative GUI. This means that the FreeNAS® system should be kept physically secure and that the administrative GUI should be behind a properly configured firewall and protected by a secure password.


Set the Administrative Email Address
FreeNAS® provides an Alert icon in the upper right corner to provide a visual indication of events that warrant administrative attention. The alert system automatically emails the root user account whenever an alert is issued. FreeNAS® also sends a daily email to the root user which should be read in order to determine the overall health of the system.

To set the email address for the root account, go to Account → Users → View Users. Click the Change E-mail button associated with the root user account and input the email address of the person to receive the administrative emails.
 

Enable Console Logging

To view system messages within the graphical administrative interface, go to System → Settings → Advanced. Check the box “Show console messages in the footer” and click Save. The output of tail -f /var/log/messages will now be displayed at the bottom of the screen. If you click the console messages area, it will pop-up as a window, allowing you to scroll through the output and to copy its contents.


Other:

  • Change the timezone to the appropriate region

ZFS Volume Manager:

As mentioned above data security is very important so I will be mirroring my 3TB drives using the ZFS filesystem.

“If you have unformatted disks or wish to overwrite the filesystem (and data) on your disks, use the ZFS Volume Manager to format the desired disks into a ZFS pool.”

Click on Storage → Volumes → ZFS Volume Manager.

Simply create a volume name, add both the disks and select “Mirror” from the drop-down box. You can then ‘add’ the volume.

Create a Share:
Once you have created a volume, you need to create a share. There are three different types of shares you can make:
  1. Apple (AFP): FreeNAS® uses Netatalk to provide sharing services to Apple clients. This type of share is a good choice if all of your computers run Mac OS X. Configuration examples can be found here.
  2. Unix (NFS): this type of share is accessible by Mac OS X, Linux, BSD, and professional/enterprise versions of Windows. It is a good choice if there are many different operating systems in your network. Configuration examples can be found here.
  3. Windows (CIFS): FreeNAS® uses Samba to provide the SMB/CIFS sharing service. This type of share is accessible by Windows, Mac OS X, Linux, and BSD computers, but it is slower than an NFS share. If your network contains only Windows systems, this is a good choice. Configuration examples can be found here.
I went with a NFS share and set it up like this:

I’m not really sure what the Maproot User, Maproot Group, Mapall User and Mapall Group options are but after trying several configurations I found if I had Mapall User set to “root” and the others to “N/A” I could mount the share.

Mount the Share:

Linux (Mint):

To mount you need to create an empty directory and then mount the NFS share:
mkdir ~/Desktop/3TB.Mirror
sudo mount -t nfs 192.168.1.11:/mnt/Mirror3TB ~/Desktop/3TB.Mirror/ 
The mount command produced an error along the lines of:
mount: wrong fs type, bad option, bad superblock on /mnt
To fix this I installed the following package:  
sudo apt-get install nfs-common
Windows:
It seams that NFS is not properly supported in windows and it can be complicated to get access to the drives. Apparently you can use Nekodrive or NFSv4.1 Client for Windows, but it is probably easier to just use a SAMBA share.

Reading:

ZFS Raid Levels:
Features/Ideas:
Advertisements