User Tools

Site Tools


rsync

Rsync

Commonly used switches for rsync

with status and Common variable

rsync --verbose --progress --stats --compress --recursive --times --perms --links <source> <destination>  (location is defined as [hostname]::path)

SSH Wrapper

SSH Wrapper allows to transfer files using rsync over SSH.
Mostly usefull when dont have Rsyncd not running and have only access over ssh.

rsync -av -e "ssh -l testet" <source> <destination>

Limit Bandwidth / Disk I/O

To limit bandwidth when transferring over Network.
OR
Limit Disk I/O when transferring between Disk.
Use “–bwlimit” switch. it is measured as “KBytes”

Following example limit 100 MB/s

rsync -avgop --progress --bwlimit=102400 /mnt/drive1 /mnt/driv2

General rsync Commands

Authenticated Rsync

define rsync mount point in rsyncd.conf

| rsyncd.conf
[root]
        path = /srv/www/htdocs
        secrets file = /etc/rsyncd/rsync.secret
        auth users = htdocs
        read only = false
        write only = true
        list = false
| rsync.secret
rsyncusr:password123

NOTE :

  • Password is clear text password.
  • Make sure password file is not world readable else it will fail to authenticate.

Define script for rsync OR run it from command line.

| rsync_test.sh
#!/bin/sh
 
export RSYNC_PASSWORD=password123
/usr/local/bin/rsync -az --delete --exclude='.*' /srv/www/htdocs/ rsync://rsyncusr@rsync.host.com/root/
rsync.txt · Last modified: 2010/10/05 23:48 by k2patel