How to Configure Distributed File System (DFS) on Windows Server 2016

The Distributed File System (DFS) in Windows Server 2016 provides two complementary technologies: DFS Namespaces and DFS Replication. DFS Namespaces allows you to group shared folders located on different servers into a single, logical namespace, giving users a unified view of file shares regardless of their physical location. DFS Replication (DFSR) synchronises file content between servers using a compression algorithm that transfers only changed data blocks. Together, these features enable resilient file access, load distribution, and branch office data synchronisation.

Step 1: Install DFS Features

Install the DFS Namespaces and DFS Replication role services on all servers that will participate in the DFS topology. Run the following on each server:

Install-WindowsFeature -Name FS-DFS-Namespace, FS-DFS-Replication -IncludeManagementTools

This installs both the role services and the DFS Management console. Verify installation was successful:

Get-WindowsFeature -Name FS-DFS-Namespace, FS-DFS-Replication

Step 2: Create a DFS Namespace

A DFS namespace provides a virtual folder structure that users connect to. There are two types: domain-based namespaces (recommended for production, stored in Active Directory) and standalone namespaces (stored on a single server). To create a domain-based namespace using PowerShell:

New-DfsnRoot -TargetPath "\Server01DFSRoot" -Type DomainV2 -Path "\domain.localFiles"

The -Path parameter specifies the UNC path users will use to access the namespace. The -TargetPath is the physical folder on the server. Ensure the folder exists first:

New-Item -ItemType Directory -Path "C:DFSRoot"
New-SmbShare -Name "DFSRoot" -Path "C:DFSRoot" -FullAccess "Domain Admins" -ReadAccess "Domain Users"

Step 3: Add Namespace Folders and Targets

Namespace folders are virtual subfolders within the namespace that point to real shared folders on file servers. Create a namespace folder and add targets (the actual share locations):

New-DfsnFolder -Path "\domain.localFilesHR" -TargetPath "\FileServer01HR"
New-DfsnFolder -Path "\domain.localFilesFinance" -TargetPath "\FileServer01Finance"

To add a second target for redundancy and load balancing, add an additional folder target pointing to a replica on another server:

New-DfsnFolderTarget -Path "\domain.localFilesHR" -TargetPath "\FileServer02HR"

Verify your namespace configuration:

Get-DfsnFolder -Path "\domain.localFiles*"
Get-DfsnFolderTarget -Path "\domain.localFilesHR"

Step 4: Configure Referral Ordering

DFS uses referrals to direct clients to the appropriate target server. You can control the order in which clients are referred to targets using the referral ordering method. The recommended setting for branch offices is Lowest-cost which uses Active Directory site information to direct users to the nearest server:

Set-DfsnFolder -Path "\domain.localFilesHR" -ReferralPriorityClass sitecost-high

Step 5: Set Up DFS Replication

DFS Replication keeps the content of replicated folders synchronised across multiple servers. First, create a replication group using DFS Management or PowerShell. Then add the servers as members and configure the replicated folder:

New-DfsReplicationGroup -GroupName "HR Replication Group" -DomainName "domain.local"

Add member servers to the replication group:

Add-DfsrMember -GroupName "HR Replication Group" -ComputerName "FileServer01"
Add-DfsrMember -GroupName "HR Replication Group" -ComputerName "FileServer02"

Create the replicated folder and specify the content path on the primary member:

New-DfsReplicatedFolder -GroupName "HR Replication Group" -FolderName "HR"
Set-DfsrMembership -GroupName "HR Replication Group" -FolderName "HR" -ComputerName "FileServer01" -ContentPath "D:HR" -PrimaryMember $true
Set-DfsrMembership -GroupName "HR Replication Group" -FolderName "HR" -ComputerName "FileServer02" -ContentPath "D:HR" -PrimaryMember $false

Step 6: Create Replication Connections

Define the replication connections (topology) between group members. A hub-and-spoke topology works well for branch offices. For a two-server setup, add a bidirectional connection:

Add-DfsrConnection -GroupName "HR Replication Group" -SourceComputerName "FileServer01" -DestinationComputerName "FileServer02"

Step 7: Configure Replication Scheduling and Bandwidth

By default, DFSR replicates continuously with no bandwidth throttling. To restrict replication to off-hours on a specific connection:

Set-DfsrConnection -GroupName "HR Replication Group" -SourceComputerName "FileServer01" -DestinationComputerName "FileServer02" -Description "Scheduled bandwidth limited link"

Use the DFS Management console to configure detailed bandwidth and schedule policies through the graphical interface for more granular control over replication windows.

Step 8: Monitor DFS Replication Health

Monitor the health and backlog of DFS Replication using the following commands:

Get-DfsrState -ComputerName "FileServer01"
Get-DfsrBacklog -GroupName "HR Replication Group" -FolderName "HR" -SourceComputerName "FileServer01" -DestinationComputerName "FileServer02" -Verbose

The DFS Management console also provides a replication health report. With DFS Namespaces and DFS Replication configured, users access file shares through a single, consistent path and data remains synchronised across all member servers automatically, providing redundancy and enabling geographically distributed file access.