Robocopy is one of my favorite and most frequently used Microsoft Windows Server 2003 Resource Kit tools. The new version of the utilityRobocopy XP010has added several features that I've recently been exploring. Based on reader questions that I've received about this new version, I've put together a list of FAQs that might serve as valuable instruction about Robocopy. Let's start with one that addresses migration concerns you might have about moving data onto Network Attached Storage (NAS) devices.
I'm migrating a large amount of data from a Windows 2000 Server system to a new NAS environment. I'm using Robocopy with switches I've used in the past for Windows-to-Windows migrations. However, my copy times don't seem to be improving with subsequent incremental copies. What am I doing wrong?
Typically, after you perform an initial Robocopy copy run of data, you should see copy times drop because you're copying only the changes that happened since the previous copy run. The amount of data turnover, including newly changed or deleted files and folders, will vary depending on your environment.
If the share is relatively inactive and little change is occurring in the data, copy times will drop dramatically after the initial run because Robocopy has few changes to deal with. If the share is very active, with files (e.g., users' .pst mail files) that are constantly changing, you might see only a slight drop in the copy time because the share contents are experiencing a high rate of data turnover. Eventually, you'll get down to a time that represents the minimum time Robocopy needs to scan through the source and destination and check for changed files.
If you aren't seeing a drop in copy times, there are two possible explanations. You could have a highly dynamic data area that's experiencing a high percentage of change, or you could have a comparison problem in which Robocopy believes changes have taken place and recopies files when, in fact, no changes have occurred.
If you're dealing with a Windows-to-NAS copy task, you need to check with the NAS device vendor to determine whether your device supports NTFS file-time standards. Robocopy's /FFT switch is particularly helpful if you have a NAS device that doesn't support NTFS's 100-nanosecond granularity and might use the FAT file system's 2-second granularity. Rounding the NTFS file times might result in the copying of files that are unchanged; Robocopy senses these files as newer or older and copies them.
The /FFT switch forces Robocopy to use the FAT file-time granularity so that the utility uses a 2-second standard for comparing files. As long as files are time-stamped within a 2-second interval, Robocopy considers them identical and doesn't copy them. This switch option can dramatically reduce your copy times and minimize copying of files that haven't actually changed.
My company has a remote location that's connected by a slow link. Users are complaining that accessing the main corporate file server over the link is too slow. They want us to place a read-only copy of the file-server data at the remote site. I need to set up a script to copy data across the slow link. The process would need to be continuous because changes are always in progress. Can I use Robocopy for my task?
A new item in Robocopy XP010 is the Monitor feature, which you control with the /MON:n and /MOT:m switches. The /MON:n switch specifies the minimum number of changes that must occur before Robocopy runs again. The /MOT:m switch specifies the minimum time, in minutes, that must elapse before Robocopy runs again. For more detailed information about the Monitor feature, see the resource kit's Robocopy.doc Help file.
Typically, Robocopy terminates after it runs through a specified source folder location. The Monitor feature puts Robocopy into a continuous mode, causing it to continuously scan the source location for changes. You can use this new feature in two ways. The first way, which addresses your query, is to continuously replicate data to a remote location. The second way is to copy the data to a new location in preparation for a migration rather than perform periodic Robocopy runs.
If you plan to use the Monitor feature, you have one consideration to keep in mind. If you launch Robocopy in Monitor mode from a script, Robocopy might continue running after your script has terminated. To solve that problem, I use Task Scheduler to launch Robocopy in Monitor mode. Here's a sample of the command string I use in Task Scheduler:
C:\robocopy.exe"\\SourceServer SourceShare""\\DestServer DestShare" /COPY:DAT /E /NP
/FFT /NS /NDL /MON:1 /MOT:1
/IPG:5 /PURGE/R:1 /W:1
/LOG+:C:\RoboLog.txt
(Be sure you type the entire command on one line.)
If you're dealing with slow links and you're receiving Robocopy copy errors, try the new version's Inter-Packet Gap (/IPG:n) switch. I've used this switch with a value of 5 on a slow link, and it significantly reduced copy errors caused by network timeouts. See the Robocopy.doc Help file for details about the /IPG switch.
We're migrating several hundred file shares to another server location. We're concerned that Robocopy might overlook a share that exists on the source server and not create it on the destination server. How can I be sure that good correspondence exists between the source and destination servers?
The TestShareCorrespondence.bat script in Listing 1 uses the resource kit utility Rmtshare to compare shares on the source and destination servers. Rmtshare is actually a Microsoft Windows NT 4.0 Resource Kit utility that more recent resource kits haven't offered. However, the tool works fine and is still available through FTP from Microsoft at ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt40/i386/rmtshare.exe.
I tested TextShareCorrespondence.bat and the other scripts discussed in this article on Windows XP Service Pack 1 (SP1) and Windows 2000 Server SP3 PCs. To use the scripts in your environment, configure the input and output file and utility locations as each script's header explains.
Column-width limitations in this publication might introduce line-wrap problems if you type the script code as it appears in the listings. I recommend downloading the actual .bat files from the Windows Scripting Solutions Web site, http://www.windowsitpro.com/windowsscripting, InstantDoc ID 44324.