Introduction
OK, your obviously not a dummy or you wouldn't be here. Now you have
to find out if I am when you work through these notes.
Here I explain how to synchronise two Windows 2000 machines using rsync.
My experience was that while available help was well written, it was interlaced
with Linux stuff which left me cold. Here I am trying to write it down
in terms everyone will understand.
Rsync
Rsync comes in two parts - a client and a server. The server receives
data from the client and stores it in sub directories of its installation
folder - nowhere else.
It needs a component called CYGWIN: I believe its a 'dll' that allows
Windows machines to run linux programs (like Rsync) in emulation mode.
Fortunately you can get these all bundled up in CWRSYNC.
The process is as follows:
- Download CWRSYNC from
their site
- On the server - the machine to receive the data - install CWRSYNC;
it will listen for any client machines that wish to synchronise. Install
it in a directory or drive where you want to store your synchronised
copies - Program Files is probably not a good idea!
- Once installed then you have to set up the server configuration file
rsync d.conf. You will see some of this is already in the default .conf
file
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid
Module definitions
Make sure that writable modules are implemented as subdirectories
of <cwRsync installation
Directory>\data. That would ensure propagation of correct ownership
for files/directories.
[test]
path = /cygdrive/c/Program Files/cwrsync/data1
read only = false
transfer logging = yes
- The Path statement is the tricky one (for me anyway); it tells the
server where to store the data but the path seems to be nonsense. The
path above corresponds to storing data in C:\Program Files\CWrsync\data1
- The [test] label indicates the name of the job (you
could have many different jobs in the .conf file)
- Create a user with restricted rights on the server machine; in the
example his userID is cwrsync; the user will have full rights on the
data directory under your cwrsync install and should be able to read
and write to the cwrsync install folder.
- Install the client on the sending machine while logged on as administrator
and be sure to set the PATH statement in the client computer to include
"C:\Program Files\cwrsync\" or wherever you installed it;
work ou the files and folders which have to be synchronised. Create
(or update on supplied) a batch file with the following lines, and store
in the CWRSYNC client directory.
set CYGWIN=nontsec
rsync -vrtz --delete /cygdrive/P/TCMPaths cwrsync@loft::test.
I can't remember what all that means - see the rsync documentation.
However the main elements are:
- rsync - the program
- -vrtz (read the manual!)
- -delete deletes files on the mirror copy if they have been deleted
on the client
- /cygdrive/...your path to be replicated; to you and me that corresponds
to P:\TCMPaths
- cwrsync@loft - the name of the cwrsync user@ the computer name (
see notes above on the setting up of this user)
- ::test (yes that's two colons) That is the name of the job, as defined
on the server, in the RSYNC conf file
Set a schedule in Windows Task schedule to run the batch file at the
interval you want. For example, I back up one machine to another at
night.
I just changed the server computer name, and have to remember to change
the rsync client information so it can find the right machine |