RSync

The server can be configured to act as a client to pull and push data to remote locations as well as act an RSync daemon server, where other clients can retrieve or store data from/to the server. In RSync language, the shared folders are called modules. Since openmediavault version 3.0 is possible now to create remote RSync jobs using ssh as transport shell. The RSync is divided in two tabs:

Jobs (client)

Based on cron, the tasks can be configured to run at certain time or make it repetitive. A few of the options explained:

Type
  • Local: This will run an RSync in between two internal folders of the server. For example you can use this to move data across different disks in your system

  • Remote: This will deactivate destination folder, and instead you’ll need to place a destination server address. You can select here:

    Mode (remote)
    • Push: store contents to a remote server

    • Pull: Retrieve contents from a remote server

Selecting one or the other will invert the folder as source or destination, the same as the server address.

Destination/Source Shared Folder

Choose a shared folder where you want the contents to be stored (pull) or you want the contents from that folder to be sent to a remote server (push).

Destination/Source Server

You need to put address server host or ip.

Examples:

If you are targeting the job against an RSync daemon server:

rsync://10.10.10.12/ModuleName
username@10.10.10.12::ModuleName
rsync://username@10.10.10.12:873/ModuleName

If you are going to connect to another server just using SSH with public key:

username@10.10.0.12:/srv/dev-disk-by-label-VOLUME1/Documents

Warning

When the RSync task is configured using ssh with PKA, the script that runs the jobs is non-interactive, this means there cannot be neither a passphrase for the private key nor a login password. Make sure your private key is not created with a password (in case is imported). Also make sure the remote server can accept PKA and not enforce password login.

Authentication (remote)

  • Password: For the remote RSync daemon module. Is not the username login password defined in the Rights Management section of the server. Read ahead in server tab.

  • Public Key: Select a key. These are created/imported from General | Certificates | SSH section.

These are the options most commonly used in RSync. At the end there is an extra text field where you can add more options.

Configuration

openmediavault makes the tasks run by placing them in /etc/cron.d/openmediavault-rsync one line per job. The cron time at the beginning, then user (root) and the target file that holds the actual RSync file with the final command, is configured in the same way as scheduled tasks The files are stored in /var/lib/openmediavault/cron.d/, prefixed with rsync and a <uuid>. A default SSH RSync job looks like this:

#!/bin/sh
# This configuration file is auto-generated.
# WARNING: Do not edit this file, your changes will be lost.
. /usr/share/openmediavault/scripts/helper-functions
cleanup() {
  omv_kill_children $$
  rm -f /var/run/rsync-05260f23-5098-4f07-9250-0b38b923ac7f
  exit
}
[ -e /var/run/rsync-05260f23-5098-4f07-9250-0b38b923ac7f ] && exit 1
if ! omv_is_mounted "/srv/dev-disk-by-label-VOLUME1/" ; then
    omv_error "Source storage device not mounted at </srv/dev-disk-by-label-VOLUME1>!"
    exit 1
fi
trap cleanup 0 1 2 5 15
touch /var/run/rsync-05260f23-5098-4f07-9250-0b38b923ac7f
omv_log "Please wait, syncing </srv/dev-disk-by-label-VOLUME1/backupdir/> to <username@backupserver.com:/opt/backup> ...\n"
eval $(ssh-agent) >/dev/null
ssh-add /etc/ssh/openmediavault-484a6837-5170-468c-aa8f-0e3cb92a641e >/dev/null
rsync --verbose --log-file="/var/log/rsync.log" --rsh "ssh -p 22" --recursive --times --archive --perms '/srv/dev-disk-by-label-VOLUME1/backupdir/' 'username@backupserver.com:/opt/backup' & wait $!
omv_log "\nThe synchronisation has completed successfully."

Server

This is the place for configuring the RSync daemon and its modules (shared folders).

Settings

Change listening port of the daemon and add extra configurations directives text field.

Modules

This is where you add shared folders to be available to the daemon. The options are explained in the module web panel. If you want to protect the modules you can select the next tab and choose a server username and establish a password. Be aware the password is only for the modules, is not the linux password. Documentation for the extra options for the modules is provided by rsyncd manual.

The above server settings are sent to this file /etc/rsyncd.conf.