TrueNAS SCALE Version Documentation
This content follows the TrueNAS SCALE 24.04 (Dragonfish) releases. Use the Product and Version selectors above to view content specific to different TrueNAS software or major version.
Configuring Rsync Tasks
9 minute read.
You 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.
Rsync provides the ability to either push or pull data. The Push function 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.
There are two ways to connect to a remote system and run an rsyc task: setting up an SSH connection or an rsync module. You need to have either an SSH connection for the remote server already configured or an rsync module configured in a remote rsync server. Each has different preparation requirements.
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 uses to run the rsync task.
Create an SSH connection and keypair. Go to Credentials > Backup Credentials to add an SSH connection and keypair. Download the keys. Enter the admin user that should set up and have permission to perform the remote sync operation with the remote system. If using two TrueNAS systems with the admin user, enter admin. If one system only uses the root user, enter root.
Update the admin user by adding the private key to user in the UI and then adding the private key to the home directory for the admin user. When the Rsync Mode is SSH,
Start the SSH service on both systems. Go to System Settings > Services and enable SSH.
Create a dataset on the remote TrueNAS (or other system). Write down the host and path to the data on the remote system you plan to sync with.
Create a module on the remote system. On TrueNAS, install an rsync app (for example, Rsyncd) and configure the module.
First, enable SSH and establish a connection to the remote server.
After establishing the SSH connection, add the rsync task.
Go to Data Protection and click Add on the Rsync Tasks widget to open the Add Rsync Task screen.
Choose a Direction for the rsync task as either Push or Pull and then define the task Schedule.
Select a User account that matches the SSH connection Username entry in the SSH Connections set up for this remote sync.
Provide a Description for the rsync task.
Select SSH in Rsync Mode. The SSH settings fields show.
Choose a connection method from the Connect using dropdown list.
If selecting SSH private key stored in user’s home directory, enter the IP address or hostname of the remote system in Remote Host. Use the format username@remote_host if the username differs on the remote host. Enter the SSH port number for the remote system in Remote SSH Port. By default, 22 is reserved in TrueNAS.
If selecting SSH connection from the keychain, select an existing SSH connection to a remote system or choose Create New to add a new SSH connection.
Enter a full path to a location on the remote server where you either copy information from or 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.
Select the schedule to use and configure the remaining options according to your specific needs.
Click Save.
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 per rsyncd.conf(5) on the rsync server. The Rsync Daemon application is available in situations where configuring TrueNAS as an rsync server with an rsync module is necessary. If the non-TruNAS remote server includes an rsync service, make sure it is turned on.
After configuring the rsync server, 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.Click in the User field then select the user from the dropdown list. The user must have permissions to run an rsync on the remote server.
Set the Direction for the rsync task. Select Pull to copy from the remote server to TrueNAS or Push to copy from TrueNAS to the remote server.
Select Module as the connection mode from the Rsync Mode dropdown.
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 still run the rsync task by going to Data Protection and clicking then the Run Now play_arrow icon for the rsycn task.
Click Save.