Use Robocopy to Preseed Files for DFS Replication

I’ll write this here first, since it’s important: The folder in which you are robo-copying (ex c:\test) must not exist on the destination server (ex. f:\test).

  • If you create the folder manually on the destination server, the file-hashes will not match and DFSr will see a conflict. So make sure your destination (ex. f:\ ) doesn’t contain a folder named the same as the source folder.

Pre-seeding your DFS Replication Group with Robocopy:

  1. Log on to the destination server with an Administrator account.

  2. Open an elevated command prompt or Powershell.

  3. Copy files from source to destination using the following command, substituting your own source, destination, and log file paths.

This command copies all contents of the source folder to the destination folder, and in all cases it should be creating the destination folder as well.

Here is an explanation of the parameters from the example above:

Parameter Description
“<source replicated folder path>” Specifies the source folder to preseed on the destination server.
“<destination replicated folder path>” Specifies the path to the folder that will store the preseeded files.

Important
The destination folder must not already exist on the destination server. To get matching file hashes, Robocopy must create the root folder when it preseeds the files.
/e Copies subdirectories and their files, as well as empty subdirectories.
/b Copies files in Backup mode.
/copyall Copies all file information, including data, attributes, time stamps, the NTFS access control list (ACL), owner information, and auditing information.
/r:6 Retries the operation 6 times when an error occurs.
/w:5 Waits 5 seconds between retries.
MT:64 Copies 64 files simultaneously.
/xd DfsrPrivate Excludes the DfsrPrivate folder.
/tee Writes status output to the console window, as well as to the log file.
/log <log file path> Specifies the log file to write. Overwrites the file’s existing contents. (To append the entries to the existing log file, use /log+ <log file path>.)
/v Produces verbose output that includes skipped files.

There are other parameters which are not used in this example. If you will replicate larger files primarily, you might be able to increase copy performance by adding the /j option for unbuffered I/O. You may also increase the thread count if you find out through testing that you have the capacity to set a higher value (thread count) for the /MT parameter.

For more information about Robocopy parameters, see the Robocopy command-line reference.

Example:

The following command replicates the root folder and files from the source replicated folder E:\RF01 on SERVER01 to data drive D: on the destination server, SERVER02:

  • It is important to note that this method is ran interactively on the destination server, where it is accessing SERVER01’s E: drive over SMB and copying the files locally.
  • This is the way I prefer using robocopy, rather than specifying a remote destination which seems rather unsettling.

To avoid potential data loss when you use Robocopy to preseed files for DFS Replication

Do not make the following changes to the recommended parameters:

  • Do not use the /mir parameter (which mirrors a directory tree) or the /mov parameter (which moves the files, and then deletes them from the source).
  • Do not remove the /e, /b, and /copyall options.

 

After copy finishes:

You will get a report at the bottom of your shell, which will look something like this:

  Examine the log for any errors or skipped files.

  • You might see that files were skipped.
  • DFS Replication will take care of copying any files that were skipped in the robocopy, so it’s up to your judgement whether or not to keep using robocopy to transfer the remaining files or to proceed with DFSr.

Validate Files

You can use Get-DfsrFileHash cmdlet in Windows PowerShell or the Dfsrdiag filehash command to validate the preseeded files by comparing file hashes on the source and destination servers:

 

For more detailed instructions instructions, see Validate Preseeded Files for DFS Replication.


Leave a Reply

Related Posts

File Services

How to Enable Shadow Copies for a volume in Windows Server 2012 R2

Enable Shadow Copies (Enable Previous Versions) Click Start , point to Administrative Tools , and then click Computer Management .   In the console tree, right-click Shared Folders , click All Tasks , and then click Configure Shadow Copies .   The window that opens will look Read more…

Windows Server

Send message to all users logged into Windows Server 2012 R2 Terminal Server

Hi. It’s me. You are trying to upgrade a server but there are people logged in. You want to tell them all that you’ll be doing work, so you need to send a message… It’s Read more…

Group Policy

Deny Remote Desktop (RDP) login for all but your account

My computer is on a domain. I wanted to enable RDP access so I could work remotely, however in doing that, I’m letting my colleagues and others in my organization log in to my PC, Read more…

%d bloggers like this: