Get a Quote   (408) 943-4100               TrueNAS Discord      VendOp_Icon_15x15px   Commercial Support Toggle between Light and Dark mode

Configuring Rsync Tasks

  10 minute read.

Last Modified 2022-09-21 09:42 EDT

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. These instructions assume that both sides of the rsync task, host and remote, use a TrueNAS systems.

Rsync Service and Modules

The rsync task does not work unless the related system service is turned on. To turn the rsync service on, go to System > Services and toggle the Rsync on. To activate the service whenever TrueNAS boots, select the Start Automatically checkbox.


Click the to configure the service on the Services > RSYNC > Rsync screen. There are two tabs for rsync configuration: basic Configure options and Rsync Module creation and management.

Rsync Basic Requirements

For an remote synch (rsync) task to work you need to first:

  • Create a dataset on both the TrueNAS and know the host and path to the data on the remote system you plan to sync with.

  • Create at least one rsync module in TrueNAS SCALE in Services > Rsync > Rsync Module


    Create an SSH connection in Credentials > Backup Credentials > SSH Connections.

  • Turn on the rsync service on both the TrueNAS and in the remote server.

Rsync provides the ability to either push or pull data. The Rsync Tasks task push function copies data from the TrueNAS host system to a remote system. The Rsync Tasks task pull function moves or copies data from a remote system and puts on the TrueNAS host system.

The remote system must have the rsync service activated.

Creating an Rsync Task

(Video URL:

Go to Data Protection > Rsync Tasks and click Add to open the Add Rsync Task configuration screen.


Enter or use the arrow_right to the left of folder/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 the TrueNAS SCALE server location, or Push to copy from the 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 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.


Choosing a Presets option populatess in the rest of the fields. To customize a schedule, enter crontab values for the Minutes/Hours/Days.

These fields accept standard cron values. The simplest option is to enter a single number in the field. The task runs when the time value matches that number. For example, entering 10 means that the job runs when the time is ten minutes past the hour.

An asterisk (*) means match all values.

You can set specific time ranges by entering hyphenated number values. For example, entering 30-35 in the Minutes field sets the task to run at minutes 30, 31, 32, 33, 34, and 35.

You can also enter lists of values. Enter individual values separated by a comma (,). For example, entering 1,14 in the Hours field means the task runs at 1:00 AM (0100) and 2:00 PM (1400).

A slash (/) designates a step value. For example, entering * in Days runs the task every day of the month. Entering */2 runs it every other day.

Combining the above examples creates a schedule running a task each minute from 1:30-1:35 AM and 2:30-2:35 PM every other day.

TrueNAS has an option to select which Months the task runs. Leaving each month unset is the same as selecting every month.

The Days of Week schedules the task to run on specific days in addition to any listed days. For example, entering 1 in Days and setting Wed for Days of Week creates a schedule that starts a task on the first day of the month and every Wednesday of the month.

The Schedule Preview dipslays when the current settings mean the task runs.

Examples of CRON syntax

*Every item.* (minutes) = every minute of the hour.
* (days) = every day.
*/NEvery Nth item.*/15 (minutes) = every 15th minute of the hour.
*/3 (days) = every 3rd day.
*/3 (months) = every 3rd month.
Comma and hyphen/dashEach stated item (comma)
Each item in a range (hyphen/dash).
1,31 (minutes) = on the 1st and 31st minute of the hour.
1-3,31 (minutes) = on the 1st to 3rd minutes inclusive, and the 31st minute, of the hour.
mon-fri (days) = every Monday to Friday inclusive (every weekday).
mar,jun,sep,dec (months) = every March, June, September, December.

You can specify days of the month or days of the week.

TrueNAS lets users create flexible schedules using the available options. The table below has some examples:

Desired scheduleValues to enter
3 times a day (at midnight, 08:00 and 16:00)months=*; days=*; hours=0/8 or 0,8,16; minutes=0
(Meaning: every day of every month, when hours=0/8/16 and minutes=0)
Every Monday/Wednesday/Friday, at 8.30 pmmonths=*; days=mon,wed,fri; hours=20; minutes=30
1st and 15th day of the month, during October to June, at 00:01 ammonths=oct-dec,jan-jun; days=1,15; hours=0; minutes=1
Every 15 minutes during the working week, which is 8am - 7pm (08:00 - 19:00) Monday to FridayNote that this requires two tasks to achieve:
(1) months=*; days=mon-fri; hours=8-18; minutes=*/15
(2) months=*; days=mon-fri; hours=19; minutes=0
We need the second scheduled item, to execute at 19:00, otherwise we would stop at 18:45. Another workaround would be to stop at 18:45 or 19:45 rather than 19:00.
Click Save.

Creating an Rsync Task Using Module Mode

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.

After adding the rsync module, go to Data Protection > Rsync Tasks, and click Add to open the Add Rsync Task configuration screen.

Enter the required information as described in Creating an Rsync Task above.


Select the direction for the rsync task.

Next, enter the Remote Host IP address or hostname. Use the format username@remote_host when the username differs from the host entered into the Remote Host field.

Now select Module from the Rsync Mode dropdown list, and then enter either the remote system host name or IP address exactly as it appears on the remote system in Remote Module Name.

Select a schedule for the rsync task.

Configure the remaining options according to your specific needs.

If you leave the Enable checkbox cleared it disables the task schedule, but you can still save and run the rsync task manually.

Click Save.

Creating an Rsync Task Using SSH Mode

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:

Select Semi-automatic as the Setup Method Select Private Key to Generate New

Creating an SSH Connection Using CLI in Shell

You can use System Settings > Shell and TrueNAS command-line to set up an SSH connection.

To use a command line, go to the Shell on the host system. Enter su - {USERNAME}, where {USERNAME} is the TrueNAS user account that runs the rsync task. Enter ssh-keygen -t rsa to create the key pair. When prompted for a password, press Enter without setting a password (a password breaks the automated task). Here is an example of running the command:

truenas# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification is saved in /root/.ssh/id_rsa.
Your public key is saved in /root/.ssh/
The key fingerprint is:
SHA256:NZMgbuPvTHeEqi3SA/U5wW8un6AWrx8ZsRQdbJJHmR4 tester@truenas.local
The key randomart image is:
+---[RSA 2048]----+
|      . o=o+     |
|     . .ooE.     |
|      +.o==.     |
|     o.oo+.+     |
|     ...S+. .    |
|    . ..++o.     |
|     o oB+. .    |
|    . =Bo+.o     |
|     o+==oo      |

The default public key location is ~/.ssh/ Enter cat ~/.ssh/ to see the key and copy the file contents.

Copy it to the corresponding user account on the remote system in Credentials > Users. By default, SCALE only displays the root user and prompts you to display hidden users. Follow the directions to locate the sshd user account. Click on the sshd user and then on Edit. Paste the key in SSH Public Key.

Next, copy the host key from the remote system to the host system user .ssh/known_hosts directory, using ssh-keyscan.

On the host system, open the Shell and enter ssh-keyscan -t rsa {remoteIPaddress} >> {userknown_hostsDir} where {remoteIPaddress} is the remote system IP address and {userknown_hostsDir} is the known_hosts directory on the host system. Example: ssh-keyscan -t rsa >> /root/.ssh/known_hosts.

After establishing the SSH connection, add the rsync task.

Go to Data Protection > Rsync Tasks and click Add to open the Add Rsync Task configuration screen.


Enter the required information as described in Creating an Rsync Task above.

Select a User account that matches the SSH connection Username entry in the SSH Connections you set up.

Choose a Direction for the rsync task as either Push or Pull and then define the task Schedule.

Next, enter the Remote Host IP address or hostname. Use the format username@remote_host if the username differs on the remote host.

Select SSH in Rsync Mode. The SSH settings fields display.

Enter the SSH port number in Remote SSH Port. By default, 22 is reserved in TrueNAS.

Enter or browse to the location on the remote server where you either copy information from or to in Remote Path. Maximum path length is 255 characters.

Select Validate Remote Path if the remote path location does not exist to create and define it in Remote Path.

Select the schedule to use and configure the remaining options according to your specific needs.

Additional options for the SSH Rsync Mode:

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 icon.

Click Save.

Related Content