File share migration – Phase 2 – Robocopy

Following Phase 1 of file share discovery, phase 2 will do the initial seeding and copying of all data from the older Windows 2003 file server to the newer Windows 2012 R2 file server. The script can be downloaded from the Microsoft script center repository.

The same script can be used to run a refresh of the data. It will copy newer and changed files every time it runs. If interrupted, the script can simply be run again. Again only newer or changed files will be copied.


  • The same drives must exist on the new 2012 R2 server as the old 2003 server. So, if we have drive letters F, H, M on the older server we must have the same drive letters on the new server.
  • The drives on the new servers must have enough disk space to accommodate all copied data. If the drives on the new file server are formatted using a larger allocation unit size such as 64 KB, actual disk space used on the new server may exceed disk space used on the old server particularly if copying many files under 64 KB each.

Here’s an example output when running this script:


  • Robocopy copies NTFS permissions on files and folders assigned to domain users and groups. It will not copy permissions to files and folders assigned to local users or groups.
  • Robocopy is unaware of inherited NTFS permissions, and will not copy inherited permissions. This is why this script starts from the root of each drive letter to ensure that all NTFS permissions are captured.
  • This script is intended to run in the context of a domain user account with local administrative permissions on both the source and target servers.
  • Robocopy will copy files with paths longer than 256 characters
  • Depending on how much data is being copied, network speed, storage subsystem speed, and whether /IPG option is used with Robocopy to throttle down the copy process, this can take several hours, days, or weeks.

Robocopy options used:

  • /XJ :: eXclude Junction points. (normally included by default).
  • /R:0 :: number of Retries on failed copies. This is set to not retry failed files. Failed files will be addressed in next phases of the file migration.
  • /W:0 :: Wait time between retries: default is 30 seconds. Choosing no waiting here. Again will be addressed in next phases.
  • /IT :: Include Tweaked files (A Tweaked file is defined to be one that exists in both the source and destination, with identical size and time stamp, but different attribute settings).
  • /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
  • /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
  • /NP :: No Progress – don’t display percentage copied.
  • /TEE :: output to console window, as well as the log file.
  • /ZB :: use restartable mode; if access denied use Backup mode.
  • /LOG+:file :: output status to LOG file (append to existing log).

Since this will be run against production servers, you may want to consider the /IPG option:

/IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.

For example, using /IPG:100 will slow down copying by waiting 100 ms between each packet to reduce the load on the source server. This will also make the migration process and file copy longer.


5 responses

  1. Pingback: File share migration – Phase 3 – importing file share information | Sam's Corner

  2. nf

    you mention that this has to work with the same destination drives. what if I have two servers consolidating to one but want to migrate to all one drive/volume on the dest. server

    July 14, 2015 at 11:38 am

    • Right, this process is intended for files and shares migration from one server to another. It’s not designed to merge/consolidate files and shares from multiple servers into one. I suppose a similar process/script can be designed for that purpose.

      July 16, 2015 at 5:40 pm

  3. TS

    Hello – what about if the drive letter of the destination server is different? I.e. the drive letter on the source computer is F drive whilst the target server drive will be the root drive c?

    July 28, 2016 at 1:21 am

  4. vikas khandola

    use robocopy

    February 14, 2018 at 10:59 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.