Wednesday, February 18, 2015

[FreeNAS]: Configuring FreeNAS to Setup ZFS Storage Disks and Creating NFS Shares On FreeNAS – Part 2

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.
Add ZFS Disks to FreeNAS
Add ZFS Disks to FreeNAS

Requirements

  1. Installation of FreeNAS (Network-attached Storage) – Part 1
After installation and configuration of FreeNAS server, following things needs to be done under FreeNAS Web UI.
  1. Set the web protocol to HTTP/HTTPS.
  2. Change web GUI address to 192.168.0.225.
  3. Change Languages, Keyboard Map, Timezone, log server, Email.
  4. Add ZFS supported storage volume.
  5. 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-9.2.1.8-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 1we 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.
Change System Information
Change System Information
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 toAccount 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.
Enable FreeNAS Email Notifications
Enable Email Notifications
Click on Modify User tab to enter the email address and password of the user and click OK to save the changes.
Create FreeNAS Email User
Create Email User
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.
Email User Details
Email User Details
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.
Enable FreeNAS Console Message
Enable Console Message
Console Message Window
Console Message Window

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 aZFS volume, select ZFS Volume Manager.
FreeNAS ZFS Volume Manager
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.
Add ZFS Storage Disks to Freenas
Add ZFS Storage Disks
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.
Define Raid5 on ZFS Disks
Define Raid5 on ZFS Disks
7. To add a RAIDz2 with double parity, you can choose the Raidz2 (same as RAID 6 with double parity) from the drop menu.
Define Raid6 on ZFS Disks
Define Raid6 on ZFS Disks
8. Mirror means cloning the same copy of each drive with better performance and data guarantee.
Define Mirror on ZFS Disks
Define Mirror on ZFS Disks
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.
Define Stripe on ZFS Disks
Define Stripe on ZFS 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.
Add ZFS Disks
Add ZFS Disks
11. After adding volumes, you will get the volume list as shown below.
ZFS Storage Disks
ZFS Storage Disks

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.
Create ZFS Dataset in Freenas
Create ZFS Datasets
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.
Set Permissions on ZFS Datasets
Set Permissions on ZFS Datasets
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.
ZFS Dataset Permissions
ZFS Dataset Permissions
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 theUnix(NFS) type.
Share ZFS Datasets
Share ZFS Datasets
16. Next, click on the Add UNIX (NFS)Share, a new window will popup to give a comment (Name) astecmint_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 theBrowse and choose the directory tecmint_docs which we have define for the data-set before and then click on OK.
Add Unix Share in Freenas
Add Unix Share
Unix Share Directory View
Unix Share Directory View
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.
NFS Share Enabled
NFS Share Enabled
Enabled NFS Share
Enabled NFS Share

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 Address192.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]
Install NFS Package
Install NFS Package
19. After NFS installed, use the following command to list the NFS share from FreeNAS.
# showmount -e 192.168.0.225
Check FreeNAS NFS Share
Check FreeNAS NFS Share
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/
Mount FreeNAS NFS Share
Mount FreeNAS NFS 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
Create File in NFS Share
Create File in NFS Share

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.
Save FreeNAS Configuration
Save FreeNAS Configuration
23. Next, click on Upload config to choose the downloaded db file and choose the file and click upload.
Download FreeNAS Configuration
Download FreeNAS Configuration
After clicking on upload config system will reboot automatically and our settings will be save.
FreeNAS Rebooting
FreeNAS Rebooting
That’s it! we have configured the storage volume and defined a NFS share from FreeNAS.

Conclusion

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.

No comments: