Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


rsync

rsync is a fast, versatile, remote (and local) file copying tool.

Reference(s)

Table of contents


Install

Install rsync:

# emerge -a net-misc/rsync
# pacman -S rsync
# apt install rsync
# apt yum rsync
# apt yum rsync

Config

See https://wiki.archlinux.org/index.php/Rsync#Trailing_slash_caveat.


Use

  • Full local backup:

    $ sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup/folder --delete --info=progress2
    

  • Full remote backup:

    $ sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} -e ssh / user@123.123.123.123:/path/to/backup/folder --delete --info=progress2
    

Tip

Make sure that the target folder, on the remote system, is owned by "user". If "user" is root, make sure to permit root login on the remote system:

# vi /etc/ssh/sshd_config
    > ...
    > PermitRootLogin yes
    > ...
# systemctl restart sshd

Restricted rsync

See https://www.guyrutenberg.com/2014/01/14/restricting-ssh-access-to-rsync/.


If this cheat sheet has been useful to you, then please consider leaving a star here.