Installation and configuration documentation of my Arch Linux setup in GitHub Pages.
This page describes how rsync
can be used to synchronize folders between different locations. The Arch Linux wiki already contains some great info on that so please read that too.
To be able to use the rsync protocol by running a server-side daemon,
rsync
should be installed on both client and server
This part describes the server configuration for an rsync daemon which can be used as target to sync to.
The rsync daemon uses configuration file /etc/rsyncd.conf
which can be configured as follows to serve a target named storage
:
uid = 0
gid = 0
use chroot = no
max connections = 4
syslog facility = local5
pid file = /run/rsyncd.pid
[storage]
path = /mnt/Storage
comment = Mass storage volume
readonly = no
The server-side rsync daemon can be started (and enabled) by calling:
sudo systemctl enable --now rsyncd
To synchronize some source folders with an rsync daemon’s target, use the following command:
rsync -ahW --info=progress2,flist0,name,remove,stats --bwlimit=81920 --delete <folder1> [<folder2> [<folder3> [...]]] server::storage
In which the options are chosen as follows (please also see rsync’s man pages):
option | purpose |
---|---|
-a | archive mode (most sane options); equals -rlptgoD |
-h | output numbers in a human-readable format |
-W | sync whole files to relieve cpu of checksumming blocks |
–info=progress2 | show total transport progress |
–info=flist0 | don’t show file list |
–info=name | show name of changed files |
–info=remove | show name of removed files |
–info=stats | show statistics |
–bwlimit=n | limit transfer to n kB/s (81920 == 80MiB) |
–delete | delete removed files from target |
To prioritize the synchronization process nice
and ionice
can be used.
E.g. when the synchronization process shouldn’t impact other process’s performance and IO, use the following command:
nice -n19 ionice -c2 -n7 rsync ...