How to Configure DFS Replication on Windows Server 2016?

This handbook explains how to set up DFS data replication in an Active Directory domain on Windows Server 2016 machines.

A Distributed File System (DFS) can be one of two types:

Namespace DFS – Namespace DFS enables you to establish virtual directory trees that connect shared files across a corporate network. Multiple DFS namespaces are available to set up. It makes it easier for users to access files that are scattered around the globe;

DFS Replication – generates a duplicated shared folder and keeps track of file modifications.

Installing DFS Namespaces and DFS Replication Roles on Windows Server 2016

Let’s install the DFS Namespaces and DFS Replication roles on the two Windows Server 2016 machines that will be used for replication.

Create a new DFS namespace using the DFS Management console (dfsmgmt.msc).
You can build a domain-based namespace or stand-alone namespace.

Domain-based namespace is a namespace that is integrated into the Active Directory. Allows you to hide the DFS namespace server name from users, as well as simplify the replacement and transfer of the namespace to another server.

Even in a workgroup, a stand-alone namespace allows you to establish DFS structures without requiring Active Directory Domain Services (AD DS). A failover cluster can be used to ensure the namespace’s high availability.

Create a new folder in the new namespace. Make sure that the new directory is accessible over the network by the UNC path dfs\namespacename\foldername (in our example it is contoso.com\public\shareddocs).

Configuring DFS Replication Between 2 Servers Running Windows Server 2016

You can now set up DFS replication. You can use DFS Replication to synchronise directories with files (replicated folders) between servers in a DFS replication group. The DFS replication group’s servers communicate with one another using DFS connections.

The Remote Differential Compression Algorithm is used to repeat changes (RDC). Only the parts of the files that have changed are reproduced. DFS replication is asynchronous, which means that sources may not be consistent at any given time.

It’s important to distinguish between FRS (File Replication Service) and DFSR (Distributed File System Replication) (Distributed File System Replication). When Windows Server 2008 introduced DFSR, it became possible to apply differential compression when only partial changes in a file were communicated over the network, rather than the complete file. The entire file is copied in FRS replication.

The use of folders between remote branches for DFS replication over slow WAN lines is advantageous.

Replication comes to a halt when communication between replication partners is lost. Replication will resume once the network has been restored.

A replication group is a collection of servers (members) that work together to replicate one or more directories.

System requirements for DFS replication:

  1. All servers in the replication group must have DFS Replication installed.
  2. The replication group’s servers must all be in the same AD forest.
  3. Forest schema version must be at least Windows Server 2003 R2, domain functional level must be at least Windows Server 2008;
  4. The NTFS file system must be used to store replicated directories. The following file systems are not supported: ReFS, FAT, and Cluster Shared Volumes.
  5. Antivirus on DFS servers must be compatible with DFS replication technology, or antivirus exceptions for duplicated directories must be added.

You must create a network shared folder on the second DFS server before configuring replication. Select the relevant namespace in the DFS Management interface and choose Add Folder Target from the context menu.

Enter the name of the shared folder and click OK (in our example it is \\HOST2\DFS\ShareDocs).

You will be prompted to create a new replication group. Click Yes.

In the DFS Replication Configuration Wizard, you need to verify the name of the replication group and the directory you want to replicate.

Check the paths to the shared folders on the servers.

Choose the primary member node where the initial data will be stored and where initial replication will take place.

Full mesh is usually chosen as the replication topology. All modifications made on one node are promptly replicated to all others in this architecture. 

The timing and bandwidth that can be used to replicate data must still be adjusted. After you’ve double-checked your settings, click Create.

Following the successful formation of a new replication group, a message should display.

This completes the DFS distributed file system and data replication configuration.

Create a new file in one of the member servers’ shared folders. Depending on the capacity of the communication connection between DFS servers and the DFS replication parameters, huge files can take many hours or even days to replicate.

If 2 users simultaneously edit (or create) the same file, then DFS replicates the version of the file that was changed (created) last. An earlier version of the file is stored in DfsrPrivate\ConflictandDeleted directory on the server that resolves the DFS replication conflict. In this case, an entry about the conflict that has occurred appears in the ConflictandDeletedManifest.xml file.

Tweaking DFS Replication

You can tweak several variables after creating a DFS replication group to improve performance.

Expand the Replication area of the DFS Management console, which contains all the replication groups.

Choose the replication group you just made. There are four tabs on the right window:

Membership is a list of network folders that data is copied across.
Connections — specifies the structure of DFS replication partners’ relationships;
DFS folder settings for replicated folders;
Permissions for replication groups are delegated.
Note the 4 GB Staging Quota setting on the Membership tab. What exactly is it? The DFS service employs intermediate hidden folders to hold modified data that must be sent to replication partners when replicating. On each server, these files are saved in the DfsrPrivateStaging subdirectory.

Open the attributes of any folder on the Membership tab and select the Staging tab. As you can see, you can define the Staging folder’s path and maximum size here (Quota). The default storage capacity is 4 GB. To improve the performance of the DFS file replication service in big infrastructures, the quota size should be increased.

This quota should not be less than the total size of the replication directory’s 32 biggest files, according to Microsoft. The following PowerShell command will return the total size of the directory’s 32 biggest files:

Get-ChildItem C:\SharedDOCS -recurse –force | Sort-Object length -descending | select-object -first 32 | measure-object -property length -sum).sum /1gb

If the DFS server’s staging quota is insufficient, occurrences with EventID 4208 are frequently reported in the event log. In this scenario, it is suggested that the staging quota be increased by 20%.

Some administrators assume that a file larger than the Staging folder’s quota cannot be copied through DFS. This isn’t correct. Such a file can also be reproduced normally, but the procedure will take many steps (the file will be divided into several portions and sent in pieces), slowing down the process significantly.

To switch the DFS directory on a specific server to read-only mode, click the directory and select Make read-only. As a result, users won’t be able to edit or create files in this directory.

On the Connection tab, you can temporarily suspend replication to one of the servers in the DFS replication group (Disable), or start forced replication (Replication Now).

Open the properties of any folder on the Replication Folders tab. A list of file extensions that are not duplicated between DFS servers can be found in the File filter field. .bak and.tmp are the default file extensions. Other file kinds that do not need to be copied, such as video (*.avi, *.mpeg), music (*.mp3, *.wav), image files (*.iso, *.wim), or other file types, can be included.

The bandwidth throttling for DFS replication between remote locations can be controlled. This is important when offices are connected by slow WAN links and you don’t want the DFS replication traffic to overload them.

A WAN connection between two sites, for example, has a bandwidth of 10 MB. During work hours, you want DFS to be limited to 6 megabits and unlimited the rest of the time.

Go to the Schedule tab > right click on the replication connection and select Properties > click on the Connections tab > go to the Connections tab > right click on the replication connection and select Properties > go to the Connections tab > right click on the replication connection Select “Custom Connection Schedule…” from the drop-down menu. Details > Edit Schedule

Here you can set a limit on the maximum channel usage by DFS replication traffic for different days of the week and daytime:

  • Monday – Friday from 8:00 AM to 5:00 PM — 6 Mb;
  • Sunday, Saturday, and Mo-Fri night — Full bandwidth.

You can use system event logs, as well as the current (percent windir percent debugDFSR.log) and archive DFSR replication logs (percent windir percent debugDFSR.log.gz) to diagnose DFS replication.

The PowerShell cmdlet Get-DFSRConnection can be used to get information about the server’s DFS replication settings.

Common DFS Replication Errors

Let’s consider the most common DFS replication errors and their solutions.

DFS Does Not Replicate Some Files

If you found that DFS Replication is not copying some files, check if they have the Temporary attribute set (0x120).

You can find such files and remove the 0x120 attribute using the following PowerShell script:

Get-ChildItem C:\DFS\DOCS -recurse | ForEach-Object -process {if (($_.attributes -band 0x100) -eq 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}

DFS Replication Error 4012

When you try to start DFS replication and get an error code 4012, it signifies the replication hasn’t been done for a long time.

The replication on the folder with the following local path: C:path was halted by the DFS Replication service. This server has been isolated from other partners for 70 days, which exceeds the MaxOfflineTimeInDays parameter’s maximum duration limit (60). The data in this folder is considered stale by DFS Replication, and this server will not replicate the folder until the problem is fixed.

You can increase this period from 60 days (default) to 120 using PowerShell:

  1. Check the current value of MaxOfflineTimeInDays:Get-WmiObject -Namespace root\microsoftdfs -Class DfsMachineConfig | fl MaxOfflineTimeInDays
  2. Increase it up to 120 days:Set-WmiInstance -Namespace root\microsoftdfs -Class DfsMachineConfig -Arguments @{MaxOfflineTimeInDays=120}
  3. Restart DFS Services.

DFS Replication Error 2104

In this case, you need to fix the broken DFS database. Follow these steps:

  1. Disable group replication (DFS Management > Replication > Replication group > Connections);
  2. Create and run the following .bat script with administrator permissions:
set DFS_DRIVE=E: net stop dfsr %DFS_DRIVE% icacls "%DFS_DRIVE%\System Volume Information" /grant "Domain Admins":F cd "%DFS_DRIVE%\System Volume Information" move DFSR %DFS_DRIVE%\DFSR_backup cd .. icacls "%DFS_DRIVE%\System Volume Information" /remove:g "Domain Admins" net start dfsr dfsrdiag PollAD /Member:%userdomain%\%computername%

Leave a Reply

Your email address will not be published. Required fields are marked *




Enter Captcha Here :