Sunday, September 18, 2011

Using rsync to copy/sync two file systems

I've used the rsync command a number of times to synchronize a couple files systems. It's particularly useful for doing backups of one set of files to another. These are some EXTREMELY loose notes about how I did things a couple times that I found in old emails.

Example 1: Replicate on directory to another place on same machine.
cd /data
rsync -a dir1 /dest

Copies all the files from /data/dir1 and drops them in /dest/dir1.

Example 2: Doing on windows with cygwin between two separate windows boxes. Very loose instructions, but a long time ago I was able to make this work between two windows boxes by using a client/server model (e.g. remotely connecting between the two boxes.)

  • install cygwin
  • Map \\axis\backup as X:
  • mkdir -p /cygdirve/x/LaptopBackup/Users-rmills
  • cd C:/Users
  • rsync -a rmills /cygdrive/x/LaptopBackup/Users-rmills
Effectively copies everything from my /Users/rmills directory to the backup directory.

Example 3: Starting from scratch and copying a lot of stuff

On a windows server box, setup K: in /rmills/rsync
  • Create rsync.conf
  • Create rsync.scrt
  • On Server:
    • rsync --verbose --daemon --config=./rsync.conf --no-detach
    • (Take away --no-detach after prove it works.)
  • On Client:
    • rsync -progress -av SomeDirectory rmills@server::vol1
    • (consider "--update" to see if it just copies a few files)
 This basically allows two rsync processes to reach out to each other and copy files.

No comments:

Post a Comment