Overview
This document describes how to use robocopy to copy large data masses to another drive or a network location.
Solution
Robocopy is a robust tool created by Microsoft for copying data to another drive, folder, or network share. For more information about robocopy, please see the reference link at the end of this article.
Here is an example process how to use robocopy to transfer vault file data to another drive.
- Use robocopy to copy the files from the source drive to the target drive while the vault is online.
- During switchover, take the vault offline.
- Use robocopy to copy any new and changed files that were added to / modified on the source drive after the initial copy.
- Switch the vault's file storage location from the existing drive to the new drive.
- Bring the vault back online.
Using robocopy will minimize the required downtime, as only new/updated files are copied during the switchover. Robocopy can be run multiple times before the switchover. Read the log file after each run to see if there were any issues or if any files were not copied. Robocopy has lots of options to use. Here is an example command to use:
robocopy C:\temp\source C:\temp\target /SEC /TIMFIX /MIR /R:1 /W:1 /NP /LOG:C:\temp\logfile.txt
Here is a breakdown of what these options do:
- First, you need to define source and target folders. You can also use a network folder.
- /SEC copies the security information from source to target. This will copy security permissions even when the file data hasn’t changed.
- /TIMFIX fixes file times on all files. This will copy timestamps even when the file data hasn’t changed.
- /MIR mirrors a directory tree. Use this option with care, as it will destroy all files in the target path which are not included in the source path.
- /R:1 is the number of retries for failed copies. Speeds up copy process if there are files which cannot be copied.
- /W:1 is the wait time between retries. Speeds up copy process if there are files which cannot be copied.
- /NP hides the progress indication of how many percent of the source files have been copied. If this is not used, large files can fill log files.
- /LOG:file outputs status to a LOG file (overwrites existing log).
If you have not used robocopy before, please try it with test data before using it on a production environment. With the wrong options, you can accidentally delete lots of files.
Reference Documents
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
