Rsync-example

From PTAGISWiki

Jump to: navigation, search

[root@phyppro1 packages]# cd /home/mirror/packages; rsync -va --delete

--exclude-from=rsync.RedHatMainExclude rh-mirror.redhat.com::redhat/
/local.ftp/ftp/disk0/mirror/redhat-main/redhat/


UGH! Don't run rsync as root, unless you are prepared to handle the security problems. Copying devices is bad (=security hole) unless you have taken steps, like disabling them (under linux: nodev mount option if on a separate partition), or using a filesystem type that doesn't support them. /dev/initctl is a fifo. You really don't need it or any of the device files. Simply don't mirror as root, or don't use -a and use -rlpt instead.

rsync -az -e ssh --delete /source /dest

-a archive mode (preserve symlinks)
-z compress
-e use alternate to rsh
--delete remove files on the target that don't exist on the sender
-n dryrun (don't sync files, just report about it)

To backup documentation directory on laptop to: rsync -azv -e ssh --delete /home/rday/doc/ news:/home/rday

To synchronize my mp3 library at home and work. Do these things on snapper.

Find out which files are different: rsync -ntr -e ssh weasel:/store/music /home/rday/music > ~/rsynclist.txt

To sync the directories: rsync -trv -e ssh weasel:/store/music /home/rday/music Hmm, this didn't work, probably because of the firewall.

Personal tools