This post may be of interest if you’re interested in accessing SMB shares hosted on different servers on your network through a single namespace.
- The guide is suitable for a small business or home network that doesn’t use a domain controller for authenticated access.
- Windows PCs are predominantly in use on the network.
- The reader has a working knowledge of FreeNAS.
- Several SMB servers exist on the network.
The majority of user data on my network is accessible through SMB shares on a primary FreeNAS file server. However, there is some data, such as archival material and backups, that is located on other secondary SMB servers on the network. If I do need to access some of that data, I often have to pause and think ‘Well, which server is that on?’. Is there a way to address this by providing, on the primary server, a consolidated view of SMB shares of interest from the secondary servers? Yes, it is possible and is accomplished through the use of Distributed File Systems (DFS). DFS provides an alternative namespace for accessing SMB shares on the network. Is additional software required? No, DFS functionality is built into Samba within FreeNAS. It just needs to be unlocked.
At the time of writing this, I am working with FreeNAS 11.1-U7 and FreeNAS 11.2-U2.1 and Windows 10 Home (Build 1809). The screenshots below are from the modern UI of FreeNAS 11.2-U2.1, but this post is just as relevant to FreeNAS 11.1-U7 with its legacy UI.
The aim of this post is to turn the primary FreeNAS server into a DFS host using Samba DFS. It will be set up such that SMB shares of interest located on secondary SMB servers, FreeNAS or otherwise, appear as if the primary server is providing them.
The key steps for setting up Samba DFS.
- Make the primary server a standalone DFS host.
- Create the DFS dataset.
- Create the DFS root share.
- Restart the SMB service.
- Add DFS targets from secondary SMB servers to the DFS root share.
Step 1: Make the server a standalone DFS host
To make the FreeNAS server a standalone DFS host, add host msdfs = yes in Auxiliary parameters of the SMB service.
Services ⇒ SMB ⇒ Configure
Step 2: Create the DFS dataset
In the examples that follow, the DFS dataset DFS resides in the pool tank.
Storage ⇒ Pools ⇒ tank ¦ Create Dataset
Step 3: Create the DFS root share
Sharing ⇒ Windows (SMB) shares ⇒ Add ⇒ Advanced Mode
To make this share the DFS root, add msdfs root = yes in Auxiliary Parameters.
Step 4: Restart the SMB service
This step starts the DFS service.
Services ⇒ SMB. Toggle Running off and then back on.
Step 5: Add DFS targets from secondary SMB servers to the DFS root share
Using the Shell, create targets in the path of the DFS root.
In the first example, the share resilio on server freenas-b2 is accessible via link resilio in the DFS root share on the DFS host freenas-b1.
In the second example, the share basil on file server freenas-l and the read-only share basil on replication server freenas-b2 are accessible via link basil in the DFS root share on the DFS host freenas-b1. If the file server freenas-l were to fail, through the link basil, DFS provides automatic failover to the read-only version of the share basil on backup server freenas-b2.
In the third example, the share archive on a Netgear ReadyNAS server is accessible via link archive in the DFS root share on the DFS host freenas-b1.
From a Windows 10 PC, the contents of the DFS root on the DFS host freenas-b1 appear as shown below.
To determine what a link points to:
To remove a link: