FreeNAS HOWTO Alan Johnson August 2012
This installation was performed using VMware workstation, however the principles are similar for a physical server. Using a Virtual Machine allows the rapid creation of virtual components such as disks and NICs and is therefore well suited to a tutorial.
FreeNAS is an excellent implementation of a robust file sharing system. It is available from iXsystems or directly from www.freeNAS.org
In this tutorial Version 8.2 was used
Select the released version
Here the 64 bit version is used
Download the ISO image
Burn the ISO image to a CD and boot from the CD, The installer should bring you to the following screen.
Select a location for the FreeNAS installation and select <OK>.
Select a fresh installation
Proceed by selecting <Yes>
After installation remove the CD and boot the newly installed FreeNAS Operating System
The system should reboot and display the menu below:
Accept the default option and proceed to the Console setup screen:
The console presents minimal configuration options. At this stage it should be possible to log in from a browser enabled client. Point the browser to the IP address displayed (192.168.48.133).
Changing the Password
The first step is to set up an admin password, select the <Account Tab> then under <Admin Account> select <Change Password>.
Creating a Volume
The machine has two smaller SCSI emulated disks of 10 GB capacity each and they will be used to create a volume on which to house the shared NAS files. Under <Storage> select <Volumes> à <View Disks>.
Edit the parameters (since these are actually virtual disks there is no benefit in enabling power management. Give the disk a descriptive name and select <OK>. Repeat for the second disk.
Creating a ZFS Mirror
From the <Volume> branch select <Volume Manager>. In this case the two disks will be set up using the ZFS file system. Select both disks, then select the Filesystem type as <ZFS> and the Group type as <Mirror>.
<Select Add Volume>
Viewing the newly created volume
The volume is now shown as <Active>.
Creating a CIFS Share
The volume will now be set up for shared access. From the <Sharing> branch select <Windows (CIFS) Shares> à <Add Windows (CIFS) Share>.
The path must be specified in the dialogue and this is obtained from the previous screen (View Volumes) which shows the mountpoint. Enable the service at the prompt.
Accessing the share from a Windows Client
After this the share should be accessible to CIFS clients –
Setting Share Permissions
Now that the share is accessible, the permissions can be set to allow for write access. This can be done by going to <Volumes> à <View Volumes> and selecting the <Change Permissions> icon .
Note: Understanding permissions is key to file sharing. UNIX and windows behave differently in how permissions are administered and separate volumes should be created for each type of file share. FreeNAS supports Apple, NFS and Windows shares.
The <Change permissions> dialogue shows a matrix grid allowing a Windows or UNIX ACL to be set up for different groups and users. THE ACLs are mutually exclusive and that is why a radio button control is presented. After setting the permissions check to see if files are read/writable to the share from a windows client.
Extending a Volume
If new disks are added to FreeNAS, then their capacity can be used to extend a volume – here a third 10GB disk has been added.
This disk is not part of a volume and its capacity is available. To add the volume to an existing volume select the volume name (here ZFSMirror) from the drop down box, highlight disk da2 and then select <Add Volume>
Note that the example above has added a non redundant volume onto a redundant pair (not a good practice), but acceptable to show how a volume would be extended) and now the capacity has doubled since the first pair shows the capacity of a single disk and the third disk is non redundant giving 2 x capacity of a single disk.
Removing a volume
Volumes can be removed by selecting the <Detach Volume> icon.
Recall that the volume has been previously set up as a CIFS share. The correct way to remove the volume is to unwind the actions by removing the CIFS share and then removing the volume.
If the user inadvertently forgets this step FreeNAS is aware that the volume is part of a share and will issue a warning accordingly. So to delete a volume the “lazy” way select <detach> as shown above and then acknowledge the warning. Here the<Delete all shares> option has been checked. In addition a data destructive option is checked in order to put the disks into a clean state. Select <Yes> to destroy the volume.
The Volume Manager now shows that no volumes exist.
Improving Fault Tolerance
To further demonstrate the capabilities of ZFS a four drive RAID-Z volume will be created. This option was not available to us earlier since there were only two drives available and two drives can only be used in a striped or mirrored configuration. Select the volume Manager as before, highlight all drives and check ZFS and RAID-Z.
The new volume was named RAIDZVolume and now shows up with a capacity of 23.4 GiB. RAID-Z makes better use of redundancy in that more capacity is available and it can tolerate a failure of any single disk.
Note if RAID-Z2 was used fault tolerance is improved at the expense of capacity. As a general rule of thumb, single disk fault tolerance should be adequate for up to 5 disks, after this consider using multi-drive fault tolerance. In addition large capacity disks can take a long time to rebuild so a volume is no longer protected with RAID-Z or mirrored redundancy schemes.
The volume manager now shows RAIDZvolume available on the path /mnt/RAIDZVolume.
Creating an iSCSI Target
NAS is a file level protocol, however FreeNAS also supports block oriented protocols such as iSCSI. To start first of select <services> à <iSCSI> à <Portals> à <Add Portal>. From the drop down select 0.0.0.0 and use the standard iSCSI port of 3260.
The next stage is to set up an initiator. The SCSI protocol uses the concept of Initiator/Target where the initiator will typically initiate a data transfer to or form a target. This could be a read or write operation. Initially all initiators will be allowed. Select <iSCSI> à <Initiators> à <Add Initiator>.
The next part is to add an Extent, do this be selecting <iSCSI> à <Extents> à <Add Extent>.
To create an iSCSI target, select <Services> à <iSCSI> à <Targets> à <Add Target>. Specify the size and name the target.
The next stage is to associate the extent that we created with the newly created target. With the iSCSI target selected, choose <Associated Targets>.
Select <Add Extent to Target> and then select the target and the extent from the drop down box. Select <OK>
The final stage is to enable the iSCSI service – do this be selecting <Services> and the toggle the iSCSI service to ON.
Setting up the iSCSI initiator
In this example the Microsoft iSCSI initiator will be used to connect to the target, Enter the IP address of the FreeNAS server into the Target field in the iSCSI initiator dialogue and then select <Quick Connect>.
When the target appears in the <Discovered Targets> box, select , <Connect> to take it out of the <Inactive> state.
Since iSCSI is a block protocol, the disk will require formatting and partitioning just like a regular disk.
After this operation the iSCSI target is now ready for use.