File transfer methods
Jump to navigation
Jump to search
rsync
Usage
rsync -a --inplace --partial --no-compress -v -h --info=name0,progress2,stats2 <HOSTS:REMOTE_SOURCE_PATH>/ <LOCAL_DESTINATION_PATH>/ # or rsync -a --inplace --partial --no-compress -v -h --info=name0,progress2,stats2 <LOCAL_SOURCE_PATH>/ <HOSTS:REMOTE_DESTINATION_PATH>/
Useful options:
- -a - implies -rlptgoD
- -r - recursive
- -l - preserve links
- -p - preserve permissions
- -t - preserve times (needed to avoid update unchanged files)
- -g - preserve group
- -o - preserve owner
- -D - transfer character and block devices, as well as special files such as named sockets and fifos
- --append-verify - use --append with a checksum
- --append - allows to continue a interrupted transfer (ONLY to update files known to be growing larger), implies --inplace
- --inplace - allow to continue a interrupted transfer in place, with no need to transfer the whole file, implies --partial
- --partial - keep partial files to be used in a subsequent transfer
- --no-compress - avoid compression, compression is only useful for slow networks
Additional options:
- -H - preserve hard links
- -A - preserve ACLs
- -X - preserve extended attributes
- --delete - remove from DESTINATION files that does not exist in SOURCE
- -c - use checksum to compare, instead of time and size (can be slower)
- -z - compress data before transfer (only useful for slow networks, conflict with --no-compress)
- -v - verbose
- -h - human readable
- --progress - show a progress
- --stats - show statistics at end
- --info - allow fine-grained output, for instance --info=name0,progress2,stats2 or --info=name1,progress0,stats2
from http://unix.stackexchange.com/a/101945
and https://superuser.com/a/1361692
rsyncd daemon
apt-get install rsync mkdir -p 750 /srv/backup/YOURDIR/ chown nobody:nogroup /srv/backup/YOURDIR/ mkdir -p /srv/config/etc/rsyncd/ cat > /srv/config/etc/rsyncd/rsyncd.conf << EOF # rsyncd.conf # port = 100873 max connections = 1 timeout = 300 lock file = /tmp/rsyncd.lock secrets file = /srv/config/etc/rsyncd/rsyncd.secrets [YOURMODULE] comment = YOURDIR path = /srv/backup/YOURDIR/ read only = no list = yes uid = nobody gid = nogroup auth users = YOURUSER # End EOF cat > /srv/config/etc/rsyncd/rsyncd.secrets << EOF # rsyncd.secrets # YOURUSER:YOURPASS # End EOF chmod 600 /srv/config/etc/rsyncd/rsyncd.secrets chown nobody:nogroup /srv/config/etc/rsyncd/rsyncd.secrets su nobody -c "/usr/bin/rsync --daemon --config /srv/config/etc/rsyncd/rsyncd.conf"; tail -10 /var/log/syslog rsync rsync://YOURUSER@localhost:100873/YOURMODULE