DFS is one of the most popular file systems in use today. It has been around for decades and is used on many operating systems. However, when it comes to initial replication, it can take a long time. If you are experiencing this issue, here are some steps you can take to speed up your replication process.
The dfs not replicating is a problem that has been present for a while. Microsoft has released DFS how to speed up initial replication.
For many years, I worked with Microsoft’s DFS service, and one of the scariest aspects of DFS was first replication – the tools to monitor and debug replication were inadequate, and things often went wrong if there was anything unexpected in the file set (like extremely long file names with special signs). The time it takes to complete initial replication is also a problem – it may take days to complete.
I just had the opportunity to build up another DFS from the ground up, and the original seed was not something I was pleased with. However, there have been some modifications to replication and DFS since Windows Server 2012 R2.
Before we get started, let’s have a look at
Make sure to put this one to the test first. Before you start fiddling with DFS in production, ensure sure you have a strong backup plan in place.
DFS has seen considerable improvements since Windows Server 2012 R2, so it’s a viable choice if you’re aware of the technology’s limits and still want to use it.
DFS has become a lot better with data cloning and higher limitations.
https://docs.microsoft.com/en-us/windows-server/storage/dfs-replication/dfsr-faq/dfsr-faq/dfsr-faq/dfsr-faq/dfsr-faq/dfsr-faq/dfsr-faq/dfsr-faq/df
Thanks to Ned Pyle for his excellent essay on this subject; it served as inspiration for my post.
https://techcommunity.microsoft.com/t5/storage-at-microsoft/dfs-replication-initial-sync-in-windows-server-2012-r2-attack-of/ba-p/424877
Prerequisites
To test my setup, I have a domain with a domain controller and two DFS servers (TDFS1 and TDFS2).
If you have a lot of DFS files, I recommend adding more hardware to your VMs (many CPU cores and as much RAM as you can spare).
Aside from the main disk, each DFS VM includes three extra drives, each of which is 30GB in capacity. This is so that we can fully test DFS replication.
We will create a folder called D:Data1 on the TDFS1 server’s D disk.
I put 1925 files from C:WindowsSysWow64 into that folder.
To both TDFS1 and TDFS2 servers, add the following roles.
Replication of DFS
Tools for Managing Remote Servers
Okay, we have everything we need to go forward.
Finally, throughout this tutorial, run POWERSHELL WITH ELEVATED RIGHTS (as administrator).
DFS Database Clone
It’s critical that we focus just on TDFS1 at first, and that we don’t include TDFS2 in the narrative. If we do that, we’ll be back to traditional reproduction, which we don’t want.
Again, we’ll start by configuring TDFS1 to point to the data. No services should be connected to TDFS1 and TDFS2.
Another thing to remember is that if the folder and data you used were previously in DFS Replication, you should skip the EXISTING DFSR DATA MUST BE CLEANED section of the tutorial.
Start elevated Powershell (as admin) on TDFS1 and put in the following commands.
Data01 will be the name of the new replication group.
-GroupName “Data01” New-DfsReplicationGroup
We’ll also add the Data1 folder to it.
-GroupName “Data01” -FolderName “Data01” New-DfsReplicatedFolder -GroupName “Data01”
The TDFS1 server will now be added to the Data01 replication group.
TDFS1 -GroupName “Data01” -ComputerName Add-DfsrMember
Make server TDFS1 the main member of the replication group and direct this group to the folder’s location.
Set-DfsrMembership -ContentPath “D:Data1” -GroupName “Data01” -FolderName “Data01” -PrimaryMember $True -ComputerName TDFS1
Config/AD should be updated.
TDFS1 –ComputerName Update-DfsrConfigurationFromAD
We may proceed when event 4112 appears in the DFS Replication log. This may take a few minutes, so be patient and keep an eye out for log events.
If you’re having trouble with Event ID 6404, go to CLEAN OLD DFSR DATA.
You can accomplish the same thing using Powershell by typing in
fl Get-WinEvent “DFS Replication” -MaxEvents 2 | Get-WinEvent “DFS Replication” -MaxEvents 2
In a cloning situation, Event 6020 is anticipated, therefore there’s nothing to be concerned about.
Now we’ll export the cloned database and XML files to the D disk.
The database and XML output folders must already exist for export (we will create one). Also, there should be no sync or initial build in progress on D disk. Make sure there isn’t any data movement on the drive/folder we just added to DFS.
It is also critical that no users upload, modify, or update files during this procedure, particularly on the downstream server!!
New-Item -Type Directory -Path “D:Dfsrclone”
In this example, I’ve set Validation to Basic. Validation is done on three levels. None, Basic, and Full are the three options.
There is no file validation on the source or destination servers. Perfect preseed data is required.
Microsoft recommends the basic version. A hash of the ACL, the file size, and the last changed time are added to each file’s existing database entry. It has a good balance of accuracy and performance.
Full – Hashing is the same as when using DFSR in regular mode. Larger than 10TB shares are not advised.
-Validation Basic Export-DfsrClone -Volume D: -Path “D:Dfsrclone”
Again, no changes should be made to the destination server (TDFS2) – no writing of files or directories to this server! It’s also a good idea to avoid using TDFS1 while this procedure is in progress. It may be utilized, but it’s better not to do so while this is being done.
Notice PreseedingHint is a command for transferring data to a target server.
Take a peek at Event Viewer – we’re looking for event 2402, which would imply a big win. With my dataset, getting event 2402 took 15 minutes. There were a lot of 2410 events and then 2402 events (this is in scenario with large quantity of files).
Get-WinEvent “DFS Replication” -MaxEvents 4 | fl Get-WinEvent “DFS Replication” -MaxEvents 4 | fl Get-WinEvent “DFS Replication” -MaxEvents 4 | fl Get-WinEvent “DFS Replication” -MaxEvents 4 | fl
Process indications 2406 and 2410, as well as 2402 and 2002, indicate that everything is back to normal. We’re good to go now.
To the Destination machine, proceed (TDFS)
On the computer we’re cloning to, there should be no files, directories, or databases (TDFS2). Microsoft also advises against creating any file shares until the copying process is complete. There should also be no user access to the destination computer when it comes to adding files and directories. The optimum course of action for the destination machine is complete quiet.
We’ll utilize the PreseedingHint command we received before; all we have to do now is put in our destination server.
My target path is “TDFS2D$Data1.”
Let’s get this command started on TDFS1.
Robocopy.exe /E /B /COPYALL /R:6 /W:5 /MT:64 /XD “D:Data1” “TDFS2D$Data1” DfsrPrivate /TEE /LOG+:preseed.log DfsrPrivate /TEE /LOG+:preseed.log
Allow robocopy to generate all of the required folders, files, and copies. Don’t use the robocopy /MIR command on the root, don’t use robocopy to create folders, and don’t use robocopy to copy files you’ve already copied. Simply run the program above without changing anything. Robocopy is delicate enough as it is; we don’t need to muck it up any more.
Copy was a huge hit.
We’ll also transfer the Dfsrclone folder, which contains the DB and XML files we generated previously.
“D:Dfsrclone” “TDFS2D$dfsrclone” /B Robocopy.exe “D:Dfsrclone” “TDFS2D$dfsrclone”
Before proceeding, we must compare certain hashes to ensure that we have properly preseeded to the TDFS2 server.
The command below will display hashes from files that begin with the letter act.
Get-DfsrFileHash TDFS1D$DATA1act* Get-DfsrFileHash TDFS2D$DATA1act* Get-DfsrFileHash TDFS2D$DATA1act*
Check your file server for random datasets to ensure that everything is in order.
Check your file server for random datasets to ensure that everything is in order.
CLEAN OLD DFSR DATA
If the data you want to preseed was previously in DFS and you want to rebuild DFS with the same data set, this is a critical step. For instance, I took. I just connected a VHDX with all of my files and directories that are part of DFS to a new VM, and I want to duplicate to a second totally fresh and clean VM. You will most likely get a 6404 error at the start of this procedure.
On TDFS2, we need to make sure that the DFSR folder does not exist on D disk.
RD ‘D:System Volume InformationDFSR’ –Recurse -Force RD ‘D:System Volume InformationDFSR’ –Recurse -Force
Everything is OK in my instance since the VM is fresh and these data have never been copied before. However, if there is existing System Volume InformationDFSR on the volume you want to replicate, this command is unlikely to function.
If you have System Volume InformationDFSR and the data cannot be fully erased, go to the section below.
However, if you have data that has already been duplicated and you have system volume informationDFSR that you are unable to remove due to problems, you may utilize this solution.
Make a new folder on the D drive. I’ll make a “empty” folder. The folder’s name literally means “empty.”
Then execute the following command.
D:empty “D:system volume informationdfsr” /MIR robocopy
Use the first RD command to remove the folder once the robocopy command completes.
We’re not out of the woods yet. This most likely means that the data you’re trying to pre-select was previously replicated by DFS.
Change folder and search choices by going to File Explorer | View | Options | Change folder and search options | View tab – mark Unmark and show hidden files, folders, and drives. Hide operating system files that are password-protected (you can hide them later again)
Return to the volume/folder you want to preseed and search for a folder called DFSRPrivate, which you should delete.
You may now proceed, or try rebuilding the group, folder, and server if you were stuck with the 6404 event id at the start.
You may now proceed, or try rebuilding the group, folder, and server if you were stuck with the 6404 event id at the start.
Now we’ll load the copied database into TDFS2 (run command on TDFS2).
I received an issue at Import-DfsrClone that I couldn’t get past – “Could not import the database clone for volume D.” Confirm that you’re in an elevated Powershell session, that the DFSR is active, and that you’re a member of the local Administrators group…” My user is domain admin/local admin, and the DFSR service was running when I ran Powershell as admin. After restarting the DFS Replication service, I was able to pass this test (DFSR).
-Volume D: -Path “D:Dfsrclone” Import-DfsrClone -Volume D: -Path “D:Dfsrclone”
So, we’re now waiting for event 2404 to happen.
Get-WinEvent “DFS Replication” -MaxEvents 4 | fl
And then there’s the 2404th occurrence. Process indicators are 2416 and 2412. In actual life, with a lot of data, getting to event 2404 took around 10-15 minutes.
Now it’s time for our TDFS2 computer to join the DFS replication group.
Connect the target computer to the DFS replication network.
We’ll now add the TDFS2 machine to the Data01 DFS group we’ve previously established.
I’ll use TDFS1 to execute the following two commands.
TDFS2 -GroupName “Data01” -ComputerName Add-DfsrMember
The TDFS1 computer will now be the DFS source, while the TDFS2 machine will be the DFS destination.
TDFS1 -SourceComputerName TDFS1 -DestinationComputerName TDFS2 Add-DfsrConnection -GroupName “Data01” -SourceComputerName TDFS1 -DestinationComputerName TDFS2
I’m going to use the TDFS2 command.
On DFS, this will add the D:Data1 folder to the previously existing Data01 group and Folder Data01.
Set-DfsrMembership -GroupName “Data01” -FolderName “Data01” -ComputerName TDFS2 -ContentPath “D:Data1” Set-DfsrMembership -GroupName “Data01” -FolderName “Data01” -ComputerName TDFS2 -ContentPath “D:Data1”
We’ll now make some changes to our setup.
TDFS1,TDFS2 Update-DfsrConfigurationFromAD
You may also use the extended command. So you don’t have to type down every single server, the second command will retrieve all members from the Data01 group.
Update-DfsrConfigurationFromAD | Get-DFSRMember -GroupName Data01
We’re currently waiting for Event 4104 to happen.
Get-WinEvent “DFS Replication” -MaxEvents 4 | fl
The event number is 4014. There is also a 5012 and a 5004, however with the 5004, nodes are connected and everything is OK.
Because I like graphical user interfaces, I’ll simply take a look at DFS Management.
It seems to be in good condition.
Is it, however, satisfactory?
Let’s make a fast diagnostic report using DFS Management.
This time I’ll make a Health report, but Propagation may also be checked and a report made from this location.
…
…
…
Create
The report should be error-free. Because we now have two-way replication, I received error 6020, which we got at the start of this scenario. You may just disregard it.
Testing
I verified this by simply creating, editing, and deleting files on both TDFS1 and TDFS2 — replication was flawless and instantaneous.
In addition, my logs are clear and error-free. With this one, we can claim that we were successful.
If you have any problems or mistakes with this, please go to the link I provided at the beginning of this tutorial; the author of that paper is a DFS specialist.
I also tested a situation in which I started a Namespace cluster after this first step.
On TDFS1 and TDFS2, I enabled file sharing on both Data folders and added the folder to the namespace. The replication status is “Not Configured” on the replication tab.
When I run the “Replicate Folder Wizard,” I receive the following “error”: The shared folder path… has previously been replicated on the server through replication group.
I can access the namespace folder sharing from a client computer in the same domain.
If I create/delete/edit a file on the client or on any of the DFS servers, replication works properly. It’s all about user rights now.
So, despite a little hiccup on the Namespace Replication tab, I’d say that this works. Because Namespaces and Replication are two separate services, this should be OK.
Conclusion
If you have DFS and need to migrate it to new computers or hardware, this is something you should give a go.
Mr.Ned Pyle performed this with more than 14milion files and maps bigger than 10TB, and it reduced down initial seeding from 24 days to a little more than 7 hours in the quickest Validation scenario (None selected).
Here’s an example of a 2.1TB drive with 1.2 million files. It took 7:26 hours to complete Basic Validation. This is a huge difference — with traditional seeding, this situation would take 3-4 days (depending on your configuration).
So, if you want to save some time, give this a try. I’ve been searching for this functionality since the days of Windows Server 2003/2008. I recall just transferring files from one DFS node to another and then beginning replication — the outcome was utter chaos and corruption. This is a fantastic improvement for DFS.
This technique is a little difficult, but it’s worth a go.
Disclaimer
The force dfs replication is a command-line tool that can be used to speed up the initial replication process.
Frequently Asked Questions
How long does initial DFS replication take?
It can take up to an hour or more for the initial replication process.
How do you force initial DFS replication?
The only way to force initial DFS replication is by deleting the file that holds the data, which can be found at C:\Users\USERNAME\AppData\LocalLow\Electronic Arts\The Sims 4. This will cause your game to start anew.
Why is DFS replication slow?
DFS replication is slow because it is a large data transfer. To speed up the process, users can try to change their settings on their computers or storage devices.