Rsync

From Indie IT Wiki

HOWTO

Install

sudo apt-get install rsync

Configure

sudo nano /etc/rsyncd.conf
max connections = 2
log file = /var/log/rsync.log
timeout = 300

[backups]
comment = Backups
path = /zfs/zpool1/backups
read only = no
list = yes
uid = root
gid = root

Start

sudo systemctl start rsync.service

Test

rsync localhost::

List Folders

rsync server::

Usage

rsync -av /path/to/folder server::folder

Large Files

Sending a 130 GB file across the local network to an SSD mounted on a nanoPC T4 ...

rsync --inplace --partial -zavP /home/myuser/.chia/mainnet/db/ nanopc-t4-1:/mnt/ssd/chia/mainnet/db/

Non Standard SSH Port

rsync -avP -e "ssh -p 2212" user@remote:/path/to/file .

INFO

Basic Syntax

rsync options source destination

Some common options:

  • a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
  • h : human-readable, output numbers in a human-readable format
  • r : copies data recursively (but don’t preserve timestamps and permission while transferring data)
  • v : verbose
  • z : compress file data

Use With Windows Files

Do not use the 'a' option when copying...

rsync -rltuv source destination

Set Bandwidth Limit

Use the --bwlimit option. If you want to set a 5MB per second limit on file transfers...

rsync --bwlimit=5000 source destination

Thanks