Configuring FreeNAS to Setup ZFS Storage Disks and Creating NFS Shares On FreeNAS


FreeNAS is a popular open-source network-attached storage (NAS) operating system based on FreeBSD. It provides a powerful and flexible platform for setting up a centralized storage system that can be accessed by multiple devices on a network. One of the key features of FreeNAS is its support for the ZFS file system, which offers a range of advanced features such as data integrity, compression, and snapshots.

In this article, we'll walk you through the process of configuring FreeNAS to set up ZFS storage disks and create NFS shares. We'll cover everything from installing FreeNAS to creating storage pools, setting up NFS shares, and accessing them from client machines. By the end of this article, you'll have a fully functional FreeNAS system with ZFS storage disks and NFS shares that you can use to store and share your data across your network.

Whether you're setting up a home media server, a small business file server, or a data backup system, FreeNAS is a powerful and flexible solution that can meet your needs. So, let's dive in and explore how to configure FreeNAS to set up ZFS storage disks and create NFS shares.

Hardware requirements

Before setting up ZFS storage disks and creating NFS shares on FreeNAS, it is essential to ensure that your hardware meets the minimum requirements. Here are the recommended hardware specifications for FreeNAS −

  • At least 8 GB of RAM

  • A 64-bit CPU

  • A minimum of two disks is required to create a ZFS pool (RAID-Z1, RAID-Z2, or RAID-Z3), but it is recommended to have at least three disks for better performance and redundancy.

  • Network interface card (NIC) that supports link aggregation (LAG)

Note that the requirements may vary based on your use case, so it is always best to check the official documentation for the latest recommendations.

Installing and configuring FreeNAS

Follow the steps outlined below to download, install, and configure FreeNAS on your system.

Step 1: Download and Install FreeNAS

The first step in configuring FreeNAS for setting up ZFS storage disks and creating NFS shares is to download and install FreeNAS on a suitable machine. You can download the latest version of FreeNAS from the official website. Once downloaded, follow the instructions provided to install FreeNAS on your system.

Step 2: Configure Network Settings

After installing FreeNAS, the next step is to configure the network settings. To do this, open a web browser and navigate to the IP address of your FreeNAS server. Once you've accessed the FreeNAS web interface, go to Network > Global Configuration and enter the appropriate network settings.

Step 3: Configure Storage Disks

The next step is to configure the storage disks. To do this, go to Storage > Disks and click on the Add Disk button. From here, you can select the disk you want to use for storage and configure it accordingly.

Once you've added the disk, go to Storage > Pools and click on the Add button to create a new storage pool. Select the type of pool you want to create (e.g., RAIDZ, RAIDZ2, or RAIDZ3), choose the disks you want to include in the pool, and configure the pool settings.

Step 4: Create ZFS Filesystem

After configuring the storage pool, the next step is to create a ZFS filesystem. To do this, go to Storage > Pools and click on the pool you just created. From here, click on the Add Dataset button and enter a name for the dataset.

Once you've created the dataset, go to the Permissions tab and configure the permissions for the dataset. You can set the owner and group permissions, as well as the read, write, and execute permissions.

Step 5: Create NFS Share

The final step is to create an NFS share. To do this, go to Services > NFS and enable the NFS service. From here, click on the Add button to create a new NFS share. Enter a name for the share, select the ZFS dataset you want to share, and configure the share settings.

Once you've created the NFS share, you can access it from any computer on the network that has an NFS client installed. Simply mount the NFS share using the IP address of your FreeNAS server and the name of the share.

Creating a ZFS Pool

Before we create a ZFS pool, we need to make sure that we have the disks that we want to use for storage. Once we have identified the disks, we can create the ZFS pool by following these steps −

  • First, log in to your FreeNAS server and go to the Storage > Pools page.

  • Click on the "Add" button to create a new pool.

  • In the "Add Pool Wizard," select "ZFS" as the pool type and click "Next."

  • Give the pool a name and select the disks that you want to use. You can select multiple disks to create a RAID-Z or RAID-Z2 configuration for data redundancy.

  • Next, configure the advanced options for the pool. Here, you can enable features such as compression, deduplication, and encryption. You can also set the size and allocation method for the pool.

  • Once you have configured the advanced options, click "Add Volume" to create the ZFS pool.

  • You should now see the newly created ZFS pool listed on the Storage > Pools page.

Here's an example of the command-line instructions for creating a ZFS pool using two disks (/dev/ada0 and /dev/ada1) with RAID-Z2 data redundancy −

zpool create mypool raidz2 /dev/ada0 /dev/ada1

Once the pool is created, you can start creating datasets and sharing them with NFS as described in the previous section. Creating a ZFS pool is an essential step in setting up a reliable and flexible storage solution with FreeNAS.

Sharing ZFS storage with NFS

Now that we have created a ZFS storage pool and added datasets to it, let's share our ZFS storage pool over the network using NFS.

Before we begin, ensure that your FreeNAS system is properly configured for network connectivity and that the NFS service is enabled.

  • Open the FreeNAS web interface and navigate to the "Services" section.

  • Click on the "NFS" service and ensure that it is "On" and "Running."

  • Next, navigate to the "Sharing" section and click on the "NFS Shares" tab.

  • Click the "Add NFS Share" button to create a new NFS share.

  • In the "Path" field, select the ZFS dataset that you want to share. Give your share a descriptive name, such as "zfs_share."

  • Under the "Permissions" tab, set the desired permissions for your share. You can choose to allow read-only or read/write access to the share.

  • Under the "NFS" tab, set the desired NFS options. For example, you can specify the IP address or range of clients that are allowed to access the share.

  • Click "Save" to create the NFS share.

Now that your NFS share is created, you can mount it on any client machine that supports NFS.

On a Linux client, you can mount the NFS share using the following command −

sudo mount -t nfs <FreeNAS-IP-Address>:/mnt/<zfs-dataset> <mount-point>

Replace <FreeNAS-IP-Address> with the IP address of your FreeNAS system, <zfs-dataset> with the name of your ZFS dataset, and <mount-point> with the path to the directory where you want to mount the NFS share.

On a Windows client, you can use the "Map Network Drive" feature to connect to the NFS share.

With your ZFS storage pool shared over NFS, you can easily access your data from any machine on your network that supports NFS.

Conclusion

FreeNAS is a powerful open-source network-attached storage operating system that provides a flexible platform for setting up a centralized storage system. It supports the ZFS file system, which offers a range of advanced features such as data integrity, compression, and snapshots.

In this article, we've shown you how to configure FreeNAS to set up ZFS storage disks and create NFS shares, from installing and configuring FreeNAS to creating storage pools, setting up NFS shares, and accessing them from client machines.

By following the steps outlined in this article, you can have a fully functional FreeNAS system with ZFS storage disks and NFS shares that you can use to store and share your data across your network. Whether you're setting up a home media server, a small business file server, or a data backup system, FreeNAS is a flexible solution that can meet your needs.

Updated on: 22-Jun-2023

153 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements