« July 2006 | Main | September 2006 »

August 16, 2006

Mirroring hard disks under XP

I have a single drive that contains most of my data and wanted to mirror it onto a spare partition on a different machine so I have a backup. Under unix/linux I would use rsync, but how do you do it under Windows?

I considered using the cygwin based tools but that would require installing cygwin on any machine on which I wanted to do mirroring.

The solution that I used was robocopy which is available in the free Microsoft resource kit tools. The program is well documented in robocopy.doc. Here is a batch file that I used to automatically mirror drive j to g.

@ECHO OFF
SETLOCAL

SET _source=j:
SET _dest=g:
SET _what=/COPYALL /B /SEC /MIR
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree

SET _options=/R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging

ROBOCOPY %_source% %_dest% %_what% %_options%

Posted by phwl at 11:28 AM | Comments (0)