Configuring FreeNAS to Setup ZFS Storage Disks and Creating NFS Shares On FreeNAS – Part 2
In our previous article, we’ve shown you how to install FreeNAS server. In this article we will cover configuration of FreeNAS and setting up storage using ZFS.
After installation and configuration of FreeNAS server, following things needs to be done under FreeNAS Web UI.
- Set the web protocol to HTTP/HTTPS.
- Change web GUI address to 192.168.0.225.
- Change Languages, Keyboard Map, Timezone, log server, Email.
- Add ZFS supported storage volume.
- Define any one of the sharing.
After making above changes in FreeNAS Web UI, we have to save the changes under System -> Settings -> Save Config -> upload Config -> Save to keep the changes permanent.
My Server Setup
Hardware : Virtual Machine 64-bit Operating System : FreeNAS-18.104.22.168-RELEASE-x64 IP Address : 192.168.0.225 8GB RAM : Minimum RAM 1 Disk (5GB) : Used for OS Installation 8 Disks (5GB) : Used for Storage
My Client Setup
Any Linux Operating system can be used.
Operating System : Ubuntu 14.04 IP Address : 192.168.0.12
Configuraton of FreeNAS and Setting up ZFS Storage
For using FreeNAS, we have to configure with proper setting after the installation completes, In Part 1 we have seen how to install FreeNAS, Now we have to define the settings that we going to use in our environment.
Step 1: Configuring FreeNAS Basic Settings
1. Login to the FreeNAS Web UI, once you login you will see Settings and System information TAB. Under Settings, change the Protocol of our web interface to use whether http/https and set the ip address that we going to use for this GUI Interface and also set, timezone, Keyboard Map, Language for GUI.
After making above changes, hit on ‘Save‘ button at the bottom to save the changes.
2. Next, setup email notification, go to the Email tab under the Settings. Here we can define the email address to get the email notification regrading our NAS.
Before that, we have to set the email in our user account, Here I’m using root as my user. So switch to Account Menu in Top. Then choose Users, here you will see the root user, selecting root user you will get the modify option in left side bottom corner below the users list.
Click on Modify User tab to enter the email address and password of the user and click OK to save the changes.
3. Then switch back to Settings and choose Email to configure the email. Here I’ve used my gmail id, you can choose whatever email id that best suits you.
Enter the the username and password for authentication and save the changes by clicking on Save.
4. Now we need to enabled Console message in the footer, to do this go to Advanced option and choose Show console messages in the footer and save the settings by clicking on Save.
Step 2: Adding ZFS Storage Volumes
5. To add ZFS storage devices, go to the Storage Menu in the Top to define the ZFS volumes. To add a ZFS volume, select ZFS Volume Manager.
Next, add a new name for your volume, Here I’ve defined as tecmint_pool. To add the available disks, click on + sign and add the disks. There are totally 8 drives available now, add them all.
6. Next, define the Raid levels to use. To add a RaidZ (same a Raid 5), click on drop down list. Here I’m adding two disk as the spare drive too. If any one of the disk fails spare drive will automatically rebuild from the parity information’s.
7. To add a RAIDz2 with double parity, you can choose the Raidz2 (same as RAID 6 with double parity) from the drop menu.
8. Mirror means cloning the same copy of each drive with better performance and data guarantee.
9. Stripe a single data to multiple disks. If we loose any one of the disk, We will loose the whole volume as useless. We won’t loose any capacity in total number of disks.
10. Here I’m going to use RAIDZ2 for my setup. Click on Add Volume to add the selected volume layout. Adding the Volume will take little time according to our drive size and system performance.
11. After adding volumes, you will get the volume list as shown below.
Step 3: Creating ZFS Datasets
12. Data-set is created inside the volume, which we have created in above step. Data-sets are just like folder with compression level, Share type, Quota and much more features.
To create a Data-set choose the volume tecmint_pool at the bottom and choose Create ZFS data-set.
Choose a data-set name, here I’ve chosen tecmint_docs, and select compression level from the list and select a share type, here I’m going to create this share for a Linux machine, so here I’ve selected the share type as Unix.
Next, enable Quota by clicking on advance menu to get the Quota. Let me choose 2 GB as my Quota Limit for this share and click on add Data-set to add.
13. Next, we need to define permissions on tecmint_docs share, this can be done by using Change Permission option. To do we have to choose the tecmint_docs, at the bottom and define the permissions.
Here I’m defining permission for root user. Select Permission recursively to get the same permission for every files and folders which created under the share.
14. Once ZFS datasets are created for Unix share, now it’s time to create a data-set for windows. Follow the same instructions as explained above, the only change is to select share type as “Windows” while adding the data-set. Those shares can be accessible from windows machines.
Step 3: Sharing ZFS Datasets
15. To share ZFS datasets on Unix machines, go to “Sharing” tab from the Top menu, choose the Unix(NFS) type.
16. Next, click on the Add UNIX (NFS)Share, a new window will popup to give a comment (Name) as tecmint_nfs_share and add authorized networks 192.168.0.0/24. Note, this will be differ for your network.
Next, select All Directories to allow to mount every directory under this share. At bottom choose the Browse and choose the directory tecmint_docs which we have define for the data-set before and then click on OK.
17. After clicking on OK a confirmation message will prompt and ask Would you like to enable this service will be shown. Click Yes to enable the sharing. Now we can see that NFS service has been started.
Step 4: Mounting NFS Share on Unix Client
18. Now login to your Unix client machine (Here I’ve used Ubuntu 14.04 and with IP Address 192.168.0.12), and check whether NFS share from FreeNAS works or not.
But, before checking FreeNAS NFS shares, your client machine must have NFS package installed on the system.
# yum install nfs-utils -y [On RedHat systems] # sudo apt-get install nfs-common -y [On Debian systems]
19. After NFS installed, use the following command to list the NFS share from FreeNAS.
# showmount -e 192.168.0.225
20. Now, create a mount directory under ‘/mnt/FreeNAS_Share‘ in Client machine and mount the FreeNAS NFS Share in this mount point and confirm it using ‘df‘ command.
# sudo mkdir /mnt/FreeNAS_Share # sudo mount 192.168.0.225:/mnt/tecmint_pool/tecmint_docs /mnt/FreeNAS_Share/
21. Once NFS share is mounted, go inside that directory and try to create a file under this share to confirm that the root user having permissions to this share.
# sudo su # cd /mnt/FreeNAS_Share/ # touch tecmint.txt
Step 5: Finally Save FreeNAS Settings
22. Now go back to the FreeNAS web UI and choose Settings under system TAB to save the changes. Click on save config to download the configuration file.
23. Next, click on Upload config to choose the downloaded db file and choose the file and click upload.
After clicking on upload config system will reboot automatically and our settings will be save.
That’s it! we have configured the storage volume and defined a NFS share from FreeNAS.
FreeNAS provide us Rich GUI interface to manage the Storage server. FreeNAS support a large file-system using ZFS with data-set which included compression, Quota, permission features. Let’s see how to use the FreeNAS as a Streaming server and torrent server in future articles.