Difference between revisions of "Rsync"

From Indie IT Wiki
Line 36: Line 36:
  
 
  rsync -nav /path/to/folder server::folder
 
  rsync -nav /path/to/folder server::folder
 +
 +
=== Non Standard SSH Port ===
 +
 +
rsync -avP -e "ssh -p 2212" user@remote:/path/to/file .
  
 
== INFO ==
 
== INFO ==

Revision as of 14:45, 18 May 2022

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 -nav /path/to/folder server::folder

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