Thank You, rsync!

by chromatic

One of the hazards of working with multiple computers is keeping data synchronized between them. I know I should keep Joey's advice about Keeping Your Life in Subversion, but configuration files aren't they only offenders.

For example, my personal web site is completely static. I generally update only a single YAML file when I need to make a change, then run a short script to rebuild the affected pages and update them on my server. scp is great for transferring files once in a while, but there's a better option for frequent updates: rsync.

I'm also slowly migrating users off of a machine being decommissioned to a new machine, and there's an hourly cron job which uses rsync to copy all of their files between the machines. Because rsync transfers only the differences between the files, it's efficient on network bandwidth (even if it still must perform a lot of file IO to traverse their directory trees). It's a program I could have written myself, very badly, but I don't have to, thanks to the Samba hackers. Best yet, I'm not even sure all of the places I have it running as part of scripts or projects; it just does its job and stays out of the way (at least once you skim the man page for the correct option... my one gripe is that I never use it manually often enough to remember exactly every flag I need in certain situations.)

Thanks to everyone who's contributed to the project for making this useful tool.


3 Comments

Gordon McCreight
2007-10-29 15:56:48
rsync and Samba are both invaluable to my little business. chromatic, thanks for reminding me about how great they are, in large part because we can take them for granted. I just donated $30 to the Samba project as a tip for a job very well done, and so they don't think I take them completely for granted.
Tobias
2007-10-31 07:21:21
Yeah, I use rsync -av(z) for all recursive copies these days--both remote and local. It's great because it always seems to do the "right thing" and its syntax doesn't vary between platforms like cp's does. I mean, a tool that can seamlessly copy your root partition to a new drive and have it "just work" is too damn awesome! Just be sure you understand the significance of a trailing '/' on the source directory path. :)
Ccx
2008-02-20 17:47:07
I use rsync even for copying whole linux system.
For versioning config files I would recommend Bazaar-ng, as it has only one config/data dir (not in each subdirectory), and it can even have the repository there. I have version control over whole /etc on one machine.