File server migration using Robocopy
I plan to migrate a file share from Windows server 2003 to Server 2012 R2 (It has more than 500 GB of data. FYI - It does not have DFS).
I thought of using below command for copying the data from source server to target server:
robocopy "\\Source server\folder\" "\\Target server\folder\" /S /E /COPY:DATSOU /R:1 /W:10 /TEE /log:<log path.txt>
During the cut over, I plan to run the same command again to copy any new/modified files.
Are there any issues with above command and do I need to include '/XO' during the cut over to exclude copying the existing files again?
Solution 1:
The command you mentioned is fine and almost reaches the goal you've set. If you really would like to perform the 1:1 migration, I would suggest you to consider following options:
robocopy "\\Source server\folder\" "\\Target server\folder\" /MIR /COPY:DATSOU /ZB /R:1 /W:10 /TEE /log:<log path.txt>
/MIR - this will MIRror a directory tree - whatever exist in source, will be copied to target. Whatever does not exist in source, will be removed (deleted) from target. By this option you will make sure, that no old data (those already removed on source) will be migrated to new server. This option is equivalent to /E plus /PURGE.
/ZB - Use restartable mode; if access denied use Backup mode. Restartable Mode - With this option, should the copy be interrupted while any particular file is partially copied, the next execution of robocopy can pick up where it left off rather than re-copying the entire file. For example, when robocopy will work on huge file (2 GB) and interrupted, after 10 seconds (/W:10) it will try to copy it again (/R:1) but will start the copy from part where it ended (not again from the beginning). Backup Mode - has to do with how robocopy reads files from the source system. It allows the copying of files on which you might otherwise get an access denied error on either the file itself or while trying to copy the file's attributes/permissions. You do need to be running in an Administrator context or otherwise have backup rights to use this flag.
You don't need to include /XO option in your final script - robocopy skips old, not updated files.