TrueNAS CORE Version Documentation
This content follows the TrueNAS CORE 13.0 releases. Use the Product and Version selectors above to view content specific to different TrueNAS software or major version.
Creating Rsync Tasks
10 minute read.
Rsync is a fast and secure way to copy data to another system, either for backup or data migration purposes. An rsync task requires configuring the local and remote host systems. These instructions assume the task uses TrueNAS systems for the local host and remote host configurations.
Rysnc requires a dataset on the local host and remote host systems. Rsync provides the ability to either push or pull data. When configuring a push rsync, data is copied from a local host system to a remote system. When configuring a pull rsync, data comes from a remote system. It is then put on the local host system.
TrueNAS has extra requirements depending on if you choose the Module or SSH rsync mode.
Before creating an rsync task on the local host system, configure a module on the remote host system. The remote host system must have the rsync service activated. When TrueNAS is the remote host system, create a module by going to Services and clicking edit for the rsync service. Click the Rsync Module tab, then click ADD. See ConfiguringRsync for more information.
Configure the local and remote TrueNAS systems for an rsync task using module mode.
Log into the local host system UI, go to Tasks > Rsync Tasks, and click ADD. Select Module in the Rsync Mode dropdown list.
a. Select the Source dataset and use it in the rsync task and a User account to run the rsync task. Select a Direction for the rsync task.
b. Select a Schedule for the rsync task.
c. Enter the Remote Host IP address or host name. Do not add http or https to the host IP address, and do not append a port number to the IP address. Use the format
username@remote_host
when the user name differs on the Remote host.d. Enter the Remote Module Name as it appears on the Remote system.
e. Configure the remaining options according to your specific needs.
Clearing Enabled disables the task schedule.
f. Enable Recursive, and leave the default values for all other settings. Do not enable Preserve Permissions.
g. Click Save.
Enable the rsysnc service. Go to System > Services and toggle the service on.
Log into the remote host system and configure the rsync task.
You do not need to add a value in Hosts Allow, but if adding an IP address of the local host (source) system, do not include http or https.
a. Enter the name given to the local host task.
b. Enter or browse to populate the path to the dataset/directory receiving the synced data from the local system.
c. Leave Enable selected.
d. Set Access Mode to read and write.
e. Leave Max Connections set to 0.
f. Add wheel to Group.
g. Click Save.
Run the local host system task based on the schedule or run it manually.
Before creating an rsync task on the host system, you need the following on the local and remote host systems:
A unique administration user with identical configurations.
An SSH connection keypair is manually added in Shell or an SSH session.
The public key is copied into the SSH Public Key field for the unique administration user.
SSH service enabled and a session established.
The Configuring an Rsync SSH Mode Task below explains when and how to create each requirement above.
Rsync task in SSH mode requires following a specific series of steps, in the correct order or the task fails to complete.
Only enable the SSH service on the local and remote systems while using it! To keep your system security-hardened, disable the SSH service when not in use.
To enable SSH in TrueNAS, go to Services and click the SSH toggle to enable (or disable) it. The toggle turns blue when the service is on or grey when it is disabled.
Establish an SSH connection with the local host system and manually create the SSH connection keypair in that session. Configuring the SSH Connection keypair in the UI can result in an error when running the rsync task.
Open two browser sessions, one for the local host system UI and the other for the remote host system UI. Log into the UI of both systems.
Use Shell or establish an SSH session with the local host and one with the remote system receiving transferred data. Log into the SSH systems of both systems.
On the remote host system:
Create a unique administration user in the UI. For this example, we created chester. Add wheel in Auxiliary Group, set up a home directory for this user, and assign read/write permissions to all files and directories. Take note of the home directory path. For this example, we created /pool/SMBHomeDataset/chester for the home directory location
Go to or create the dataset that receives synced information from the local host system. For example, we created rsync-rec. Add an ACE entry for the wheel group and give it with read/write permissions. Open the dataset permissions to full for Other if desired. This might be required if you receive a permission error executing the rsync task.
In shell or an SSH session, create a receive directory in the destination dataset. Creating a directory requires using the command-line interface.
Go to the local system to create the same unique user, and to generate the SSH keypair described below. After completing steps 1 through 3 below, return to the remote host system to add the public key part of the SSH keypair to the remote system (described in step 3.a. below).
Log into the UI for the local host system:
Create the identical unique user (chester), add wheel in Auxiliary Group, and give it read/write permissions to all files and directories. You can do this in the UI.
In Shell or the SSH session, create an SSH connection keypair and assign it to the new user chester. Run the following commands.
a. Activate the account by entering the
su chester
command in the SSH session.Generate the SSH keypair by entering the
ssh-keygen -t rsa -b 4096 “chester@hostname"
command.Where chester is the unique user created for the rsync operation, and hostname is the host name given to the local system.
Look at the randomart image to verify the keypair generated. Do not add a passphrase.
Change directory to the
/mnt/poolname/SMBHomeDataset/chester/.ssh/ location> View the generated keypair [id_rsa (private key) and id_rsa.pub (public key)] files. While in Shell enter the following command to view the keypair:cat /mnt/poolname/SMBHomeData/chester/.ssh/id_rsa
a. Copy the SSH keypair public key to paste into the remote receiving system unique user record (see step 3.b. below)
b. Go to the remote receiving system UI, edit the chester user, and paste the SSH keypair public key into the SSH Public Key field. Click Save.
c. Go to the Shell and SSH into the remote receiving host system to accept the key exchange. Run this command:
<code>su <i>chester</i></code> to activate the user, then accept the key exchange.
Return to the local host system UI, and configure the rsync task. Go to Tasks > Rsync Tasks and click ADD. Enter the following parameters:
- User = chester (the name must match the unique administration user created on both systems for the rsync task to work)
- Remote Path = paste or manually enter the path to the receiving dataset on the remote host system
/mnt/poolname</>/rsync-rec/sshreceive/ Where poolname is the name of the pool on the remote host system with the receiving dataset, and rsync-rec is the dataset created to receive the rsync file (copy) transfer.
a. Configure the SSH settings by selecting SSH on the Rsync Mode dropdown list. Enter the Port number and Remote Path.
b. Populate any other settings for your use case. Define the Source dataset for the rsync task and select an account in User.
c. Select a direction for the rsync task, either Push or Pull, and define the task Schedule.
d. Enter the Remote host IP address or host name. Use the format
username@remote_host
if the user name differs on the Remote host.e. Enter the remote host path. You cannot browse to select the remote system receiving dataset, you must manually enter the path to this dataset.
f. Enter the remaining options according to your specific needs, then click Save.
Run the rsync task by going to Tasks > Rsync Tasks and clicking , then RUN NOW.
When a TrueNAS account other than root manages the rsync task, enter su - username
, where username is the name of the TrueNAS user account that runs the rsync task.
The default public key location is
Enter cat ~/.ssh/id_rsa.pub
to see the key and copy the file contents.
The rsync task does not work when the related system service is off. To turn the rsync service on, go to Services and click the rsync toggle. The toggle is blue when the service is on, grey when it is off. See ConfiguringRsync for more information on rsync configuration and module creation.