Moving large amounts of data between Windows file servers using robocopy

Part of the reason I have been so behind on posting to this blog is that I am involved with moving ~50 windows and linux servers to a different data center. A large number of VM’s are being replaced by building out new servers on newer OS’s. I have gained plenty of new material to be posted in the blog, but haven’t had the time to write most of it down, never mind doing a proper blog post. Anyway…

One of the problems with moving data is that you also want to preserve ownership and permissions of the directory structures. This typically isn’t an issue if you are moving your own data but when moving data belonging to hundreds of other users and groups it is a requirement. Below is robocopy command that I used for much of the processes that I have been involved in. There are other ways of moving data between storage servers, but sometimes you have to run with what you have.

Before I go on – DO NOT JUST COPY AND PASTE THIS COMMAND – read the available options and use the ones that are appropriate for you. Type the following in a cmd window:

robocopy /?

In most of my cases, I wanted to replicate all data from one virtual drive to another virtual drive between two different servers. Hence, I use /MIR to specify that I want to mirror the data on the drives that are specified using the admin share names (E$). I also did not want to move recycle bin data so I used the /XD switch. /W:5 says to retry failed attempts every 5 seconds. The meat of the command are /E, /ZB, and /COPYALL options. I’ll leave you to the robocopy help output to digest these. Finally, I redirect the command’s output to a text file to be reviewed after the command has finished running. Robocopy’s help also list logging switches that you can utilize.

robocopy \storage1.mydomain\E$ \storage2.mydomain\E$ /E /ZB /COPYALL /MIR /W:5 /XD "$RECYCLE.BIN" > c:\Users\myadminaccount\Documents\robocopy.txt

“The trust relationship between this workstation and the primary domain failed.”

I have a Windows 10 VM on my laptop that I use for accessing the domain when I need to do administrative things. A recent logon attempt resulted in the error message “The trust relationship between this workstation and the primary domain failed.” being returned.

The quick fix was to log into the VM using a local user account (.\myusername) and then running the following powershell command in an elevated PS window:

Reset-ComputerMachinePassword -Credential domain\username -Server DC