TrueNAS Nightly Development DocumentationThis content follows experimental nightly development software. Pre-release software is intended for testing purposes only.
Use the Product and Version selectors above to view content specific to a stable software release.
Configuring Rsync Tasks
14 minute read.
Rsync provides fast incremental data transfer to synchronize files between a TrueNAS host and a remote system. The Push function copies data from TrueNAS to a remote system. The Pull function copies data from a remote system to the TrueNAS local host system, and stores it in the dataset defined in the Path field.
There are two ways to connect to a remote system and run an rsync task:
- Set up an SSH connection to the remote server.
- Set up an rsync module for the remote server.
Before you create an rsync task in SSH mode, add an SSH connection and keypair between the TrueNAS host and remote system. See Adding SSH Credentials for more information.
After setting up the SSH connection, configure the rsync task on the TrueNAS host.
You can set up a new SSH connection on the Credentials > Backup Credentials screen by clicking Add on the SSH Connections widget, or while setting up a new rsync task using the option to select SSH connection from the keychain in the Connect using field and selecting Add New in SSH Connection on the Add Rsync Task screen.
The following procedure provides instructions on setting up an SSH connection using the New SSH Connection screen.
Enable SSH on both the local and remote systems. On the local TrueNAS host system, go to System > Services and toggle SSH to on, and enable the SSH service on the remote host system.
Set up a home directory for the remote system administrator on the remote system. Note the path to where home directories are stored to enter on the local host TrueNAS.
If the remote system is also a TrueNAS, go to Credentials, select Users to see the list of users. Select the administration user and click Edit.
If creating a new administration user, for rsync functions, click Add. See Managing Users for more information. Take note of the path to the home directory to use in setting up the connection.
Add an SSH connection for the remote server on the local TrueNAS host system.
The generated keypair shows on the SSH Keypair widget. To download the public and private keypairs, click the file_download for the new keypair on the SSH Keypairs widget.
Enabled SSH on both the local host TrueNAS and the remote destination system.
You can use the SSS connection created in Setting Up an SSH Connection or create a new connection while configuring the rsync task.
Go to Data Protection and click Add on the Rsync Tasks widget to open the Add Rsync Task screen.
Enter or browse to the dataset or folder to sync with the remote server. Use the
to the left of the /mnt folder and each folder listed on the tree to expand and browse through, then click on the name to populate the path field.Select the administration user for the local host TrueNAS system from the User dropdown. This is the user account to perform the rsync task. The user must have read/write permissions for the local dataset.
Set the Direction for the rsync task. Select Pull to copy from the remote server to TrueNAS or Push to copy to the remote server.
Select SSH as the connection mode from the Rsync Mode dropdown to use an SSH connection. The settings fields show.
Set this to Module if syncing with a non-TrueNAS remote system. See Setting Up an Rsync Task Using Module Mode for more information.
Choose a connection method from the Connect using dropdown list.
If selecting SSH private key stored in user’s home directory, the public key for the SSH connection must be saved in the home directory for administration user. To accomplish this, copy the public key from the SSH Keypair and paste into the Authorized Keys field on the Edit User screen.
If selecting SSH connection from the keychain the system grabs the key for you, and select either the existing SSH credential from the SSH Connection dropdown list or select Add New to open the New SSH Connection configuration screen.
Enter the full path to the dataset on the remote server to either pull from or push to in Remote Path. Maximum path length is 255 characters.
If the remote path location does not exist, select Validate Remote Path to create and define it in Remote Path.
Set the schedule for when to run this task, and any other options you want to use.
If you need a custom schedule, select Custom to open the advanced scheduler window.
Select the Enabled to enable the task. Leave cleared to disable the task but not delete the configuration. You can run the rsync task at any time from the Rsync Taks widget by the Run Now play_arrow icon for the rsync task.
Click Save. The system verifies the SSH connection and adds the task to the Rsync Tasks widget. If the connection fails the system lets you know what went wrong so you can correct the issue with the connection.
Before you create an rsync task in module mode, you must define at least one module per rsyncd.conf(5) on the remote rsync server. The Rsync Daemon application is available in situations where configuring TrueNAS as an rsync server with an rsync module is necessary.
After configuring the rsync server, configure the rsync task.
If the non-TruNAS remote server includes an rsync service, make sure it is turned on.
Create a dataset on the remote system. Write down the host and path to the data on the remote system you plan to sync with.
Create an rsync module on the remote system. On TrueNAS, install an rsync app (such as Rsyncd) and configure the module.
Go to Data Protection and click Add on the Rsync Tasks widget to open the Add Rsync Task screen.
Enter or browse to the dataset or folder to sync with the remote server. Use the
to the left of the /mnt folder and each folder listed on the tree to expand and browse through, then click on the name to populate the path field.Select a User account to perform the rsync task. The user must have permissions to run an rsync on the remote server and read/write permission for the local dataset.
Set the Direction for the rsync task. Select Pull to copy from the remote server to TrueNAS or Push to copy to the remote server.
Select Module as the connection mode from the Rsync Mode dropdown. The module settings fields show.
Enter the remote host name or IP in Remote Host. Use the format username@remote_host when the username differs from the host entered into the Remote Host field.
Set the schedule for when to run this task, and any other options you want to use.
If you need a custom schedule, select Custom to open the advanced scheduler window.
Select the Enabled to enable the task. Leave cleared to disable the task but not delete the configuration.
You can run the rsync task by clicking then the Run Now play_arrow icon for the rsync task.
Click Save.