TrueNAS SCALE Documentation Archive
This content follows the TrueNAS SCALE 22.12 (Bluefin) releases. Archival documentation is provided for reference only and not actively maintained.
Use the Product and Version selectors above to view content specific to different TrueNAS software or major versions.
Configuring Rsync Tasks
11 minute read.
Last Modified 2024-03-19 08:47 EDTYou often need to copy data to another system for backup or when migrating to a new system. A fast and secure way of doing this is by using rsync with SSH.
For a remote sync (rsync) task to work you need to first:
Create a dataset on the TrueNAS
When the Rsync Mode is SSH, go to System Settings > Services and enable SSH. Create an SSH connection in Credentials > Backup Credentials > SSH Connections.
When the Rsync Mode is Module, record the host and path to the data on the remote system you plan to sync with.
Rsync provides the ability to either push or pull data. The Push direction copies data from TrueNAS to a remote system. The Pull function moves or copies data from a remote system and stores it in the defined Path on the TrueNAS host system.
When the remote system is another TrueNAS, set the Rsync Mode to SSH, verify the SSH service is active on both systems, and ensure SSH keys are exchanged between systems. When the remote system is not TrueNAS, make sure that system has the rsync service activated and permissions configured for the user account name that TrueNAS will use to run the rsync task.
Go to Data Protection > Rsync Tasks and click Add to open the Add Rsync Task configuration screen.
Enter or use the
to the left of /mnt to browse to the path to copy.Begin typing the user into the User field or select the user from the dropdown list. The user must have permissions to run an rsync on the remote server.
Select the direction. Select Pull to copy from the remote server to TrueNAS, or Push to copy from TrueNAS to the remote server.
Enter the remote host name or IP in Remote Host. You need to have the remote server rsync service configured and turned on.
Select the connection mode from the Rsync Mode dropdown. Each mode option displays settings for the selected type. You need to have either a rsync module configured in a remote rsync server or an SSH connection for the remote server already configured.
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.
Click Save.First, enable SSH on the remote system. Next enable SSH in TrueNAS; go to System > Services and toggle SSH on.
Now set up an SSH connection to the remote server. You can do this in Credentials > Backup Credentials using SSH Connections and SSH Keypairs, or using System Settings > Shell and TrueNAS CLI commands. To use the UI, see Adding SSH connections. Populate the SSH Connections configuration fields as follows:
Semi-Automatic (TrueNAS to TrueNAS)
- Select Semi-automatic as the Setup Method.
- Enter the remote TrueNAS URL.
- Fill in the remaining credentials for this TrueNAS to authenticate to the remote TrueNAS and exchange SSH keys.
- Select Private Key to Generate New.
- Select a Cipher security level for the SSH connection.
- Enter a number of seconds for TrueNAS to attempt the connection before timing out and closing the connection.
Manual (TrueNAS to Non-TrueNAS)
- Enter the remote Host name, Port, and Username.
- With these fields properly configured, click Discover Remote Host Key to connect to the remote system and automatically populate the Remote Host Key.
- Select a Cipher security level for the SSH connection.
- Enter a number of seconds for TrueNAS to attempt the connection before timing out and closing the connection.
After establishing the SSH connection, add the rsync task.
Before you create an rsync task on the host system, you must create a module on the remote system. You must define at least one module in rsyncd.conf(5) of the rsync server or in the rsync modules of another system. When TrueNAS is the remote system, create a module in System Settings > Services > Rsync on the Rsync Modules screen. See Configuring an Rsync Module for more information.
Clear the Enabled checkbox to disable the task schedule without deleting the configuration. You can still run the rsync task by going to Data Protection > Rsync Tasks and clicking then the Run Now play_arrow icon.