How to Replicate File Shares Using Microsoft RichCopy
Microsoft RichCopy is a freely available utility written by Microsoft Developer Ken Tamaru. It is designed to copy large numbers of files over the network. It is optimized for high performance and supports many useful features such as Graphical User Interface and command-line interface, extended file and directory include and exclude filtering, FTP access, retain timestamp, remove files from destination that do not exist at source, verify, retry and resume failed copies, and much more.
A common scenario that begs the use of RichCopy is to replicate images, personality packages, software packages, etc. for use with Deployment Solution 6.x. Deployment Solution 6.x does not have any built-in mechanism for file replication, so RichCopy fits very nicely here. For this article, I will show how to replicate these files in conjunction with Deployment Solution 6.x, but you can use the process to replicate any files to any servers. It is best to have the same share name on all servers, including the Deployment Server. You may name this share anything you like, but we will refer to it having the name "Deployment".
On all servers, including Deployment Server, determine a location with free space to hold all your images, personality packages, software packages, etc. with plenty of room to grow. Create a directory named "Deployment" and share this directory as "Deployment". Once you have done this, you will need to move these files into the Deployment share of your Deployment Server.
Now, you need to replicate these files to your other servers. Since Deployment Server does not automatically replicate files between servers, you will need to manage this replication yourself using Microsoft RichCopy.
On all of the servers you want to replicate the Deployment share to, download and install Microsoft RichCopy. You can find it at http://technet.microsoft.com/en-us/magazine/2009.04.utilityspotlight.aspx.
After you have installed it, you will need to determine the command-line parameters you will be using.
- Open the RichCopy Graphical User Interface.
- Enable advanced options by clicking the View Menu, then selecting Advanced.
- Next click the Option button.
- In the "Overview" page, enable all of the options you want for the copy. I recommend the following:
a. Default Source Path: \\DSSERVER\Deployment
Replace DSSERVER with the name of your Deployment Server.
b. Default Destination Path: D:\Deployment
Enter the local path to your Deployment Share here.
Enabling this option will delete any file from the destination directory that does not exist in the source directory. This makes cleanup of unused files much easier, you will only need to delete the file from the source server and the deletion will be replicated down when the scheduled replication occurs.
d. Verify (Optional)
If you don’t mind the replication taking longer, enable the Verify option to ensure that the data files preserve their integrity.
e. Ignore READ-ONLY flag
Enabling this option will allow read-only files to be overwritten.
f. Copy if Availability in Destination: Not exist
Enabling this option will copy files that exist in the source that do not exist in the destination.
g. Copy if File size is: Different
Enabling this option will copy files where the size of the source file is different than the size of the destination file.
h. Copy if Time stamp is: Updated
Enabling this option will copy files where the time stamp of the source file is newer than the time stamp of the destination file.
i. Date/Time type: Last write
Enabling this option will base the time stamp comparison on the last write time.
- In the "File attributes, Error Handling" page, specify the attributes and security information you want to copy. I recommend the following:
a. File attributes
Enabling this option will set the file attributes of the destination file to match the file attributes of the source file.
b. Time stamp
Enabling this option will set the time stamps of the destination file to match the time stamps of the source file.
c. Descretionary Access Control List
Enabling this option will set the Descretionary Access Control List of the destination file to match the Descretionary Access Control List of the source file.
Enabling this option will set the security group information of the destination file to match the security group information of the source file.
Enabling this option will set the owner user account of the destination file to match the owner user account of the source file.
f. System Access Control List
Enabling this option will set the System Access Control List of the destination file to match the System Access Control List of the source file.
- Go to the "Others" page, select the Command line parameters, and copy them to the clipboard. We will use these later. You might want to save them in a text file.
- If you want to save these settings to a file for reference later, Click OK, go to the File menu, choose Save As, give the file a name, and click Save.
- Close RichCopy.
Now that you have the command-line arguments that you need, you can set up a scheduled task to perform the replication. On all of the servers you want to replicate the Deployment share to, open the Control Panel, open Scheduled Tasks, and create a new Scheduled Task with the following settings:
- Give it any name you want, such as "Replicate Deployment Share"
- Use an account that has read/write NTFS and Share permissions to the Deployment share on the Deployment Server and local server.
- Run whether user is logged on or not.
Make sure the password is stored with the task so it can access network resources.
- For the program to run, choose "C:\Program Files\Microsoft Rich Tools\RichCopy 4.0\RichCopy.exe" on a 32-bit server or "C:\Program Files (x86)\Microsoft Rich Tools\RichCopy 4.0\RichCopy64.exe" on a 64-bit server.
- Add the command-line parameters that you copied to the clipboard earlier.
- Schedule the job to run once a day or multiple times per day. Since RichCopy only replicates files that have changed, there is less risk of scheduling multiple times per day because most of the time the schedule kicks off, no files will be copied and occasionally one or two will.
Now, all you need to do is manually run the replication command the first time or wait for the schedule to kick off. Then, your servers will all maintain a copy of the Deployment share from your Deployment Server.