Greg's how to do things with rsync
Greg's diary
Greg's home page
HOWTO index
Google

rsync is a very powerful program, but it contains a maze of twisty little options, all different, and sometimes I find I've messed things up long after it happened. I'm writing down typical incantations here.

Cloning file systems

cd oldfs
rsync -Havx . /newfs 2>/tmp/foo

Don't use -L here; it will create additional files from symlinks.

I still have great difficulty deciding where rsync puts the files. It's far too easy for it to put them one level deeper in the hierarchy than intended. That's the reason for referring to the source directory as . (dot) rather than by name.

Backing up file systems

rsync -Hav --delete-after /src/$i $dumpfs/$me-$os

Until September 2024 I didn't include the H option, but it seems wrong not to.

Backing up video

rsync > /tmp/rsyncerrs -LHav --partial --delete-after /spool/Already /spool/Docco destination
# or
cd /teevee/spool
# don't try to sync .snap or ..sujournal
rsync -LHav --partial --delete-after * /spool | tee /tmp/rsyncerrs

All file systems except the last are sources. destination is the base file system, and the files will include the path names of the sources with the initial / stripped


Greg's home page Greg's diary Greg's photos Copyright

Valid XHTML 1.0!

$Id: rsync.php,v 1.7 2024/09/13 02:47:11 grog Exp $