How to Set Up TrueNAS Replication to Another Server | INTROSERV
EUR
european

EUR

usa

USD

English En
Ex. VAT Ex. VAT 0%

How to set up TrueNAS replication to another server: step-by-step guide

Replication copies ZFS snapshots of a dataset from one TrueNAS system to another. If the source server fails or data is deleted by mistake, you can restore the data from the replicated snapshots. The first replication transfers the full dataset. Later replications are incremental: they transfer only the changes represented by newer snapshots, which usually reduces the amount of data transferred.

This guide shows how to set up push replication: the source TrueNAS sends snapshots to a destination TrueNAS over SSH on a schedule. The steps and screenshots are for TrueNAS 25.10. In other versions, menu names and field labels may differ.

What you need

You need:

  • two servers with TrueNAS 25.10 installed;
  • network connectivity between the servers;
  • an administrator account on the destination server with SSH access, a home directory and sudo permissions;
  • enough free space on the destination pool for the replicated dataset and its snapshots.

In this guide:

  • the source server is the TrueNAS whose data you want to protect;
  • the destination server is the TrueNAS that stores the copies.

To install TrueNAS on a dedicated server, see Installing TrueNAS on a dedicated server via IP-KVM and Virtual Media.

Warning

Replication does not replace backups. If data is deleted or damaged, the next snapshot and replication copy this state too. You can restore the earlier state only while an older snapshot is still kept, so set the snapshot lifetime with this in mind.

Tip

Place the destination server in a different data center from the source. Then a single failure in one location does not affect both copies.

Prepare the destination server

All steps in this section are done in the web interface of the destination server.

Create a dataset for the copies

Go to Datasets, select the pool and click Add Dataset. In Name, enter a name, for example backup. Keep the Generic preset and click Save. The replicated dataset will be created inside this dataset. Use a new, empty dataset. Do not use a dataset that contains important data or snapshots, because replication can manage and delete snapshots on the destination according to the retention settings.

Configure the administrator account

Go to Credentials > Users, select the administrator account that you will use for replication, for example truenas_admin, and click Edit.

In Allow Access, select SSH Access. Then select Allow SSH Login with Password (not recommended). Password login is needed only while TrueNAS creates the SSH connection and installs the public key. After the connection works, you can turn it off.

Check the Home Directory field in Additional Details. It must point to a real directory, for example /home/truenas_admin. Replication needs a real home directory for this account, so do not leave it set to /var/empty. If needed, click the edit icon and set the home directory.

In Sudo Commands, click the edit icon and select Allow all sudo commands with no password. TrueNAS uses passwordless sudo to run the required ZFS commands on the destination server. Click Save.

The account details now show SSH Password Login Enabled and Allowed Sudo Commands (No Password): ALL.

Warning

Allow all sudo commands with no password gives the account broad administrative privileges. For better security, use a dedicated administrator account for replication instead of your normal administrative account, and turn off password login for SSH when the setup is complete.

Enable the SSH service

Go to System > Services, find SSH and click the edit icon. Make sure Allow Password Authentication is selected and click Save.

Then click the start button next to the SSH status and turn on the Start Automatically toggle, so the service starts after a reboot. The status changes to Running.

Warning

After the replication runs successfully, you can turn off password login for SSH, both in the account settings and in the SSH service, if no other connections need it. Replication uses the SSH key.

Prepare the source server

The remaining steps are done in the web interface of the source server.

Create a dataset to replicate

Make sure the administrator account on the source server also has a home directory set: go to Credentials > Users, select the account and check the Home Directory field.

If the data you want to protect is not in a separate dataset yet, create one: go to Datasets, select the pool, click Add Dataset, enter a name, for example data, and click Save.

Create an SSH connection

Go to Credentials > Backup Credentials and click Add in the SSH Connections widget. Fill in the form:

  • Connection Name: any name, for example backup-server;
  • Setup Method: Semi-automatic (TrueNAS only);
  • TrueNAS URL: the address of the destination server, for example https: //203.0.113.20;
  • Admin Username and Admin Password: the credentials of the administrator account on the destination server;
  • Username: the same account;
  • Enable passwordless sudo for zfs commands: selected;
  • Private Key: Generate New.

Click Save. If the destination server uses the default self-signed certificate, TrueNAS shows a certificate error and asks whether to ignore it. Select Confirm and click Continue.

TrueNAS connects to the destination server, generates a key pair and installs the public key there automatically. The new connection appears in the SSH Connections widget, and its key appears in SSH Keypairs.

Create the replication task

Go to Data Protection and click Add in the Replication Tasks widget. The Replication Task Wizard opens.

What and Where

In Source Location, select On this System, and in Destination Location, select On a Different System.

In SSH Connection, select the connection you created. TrueNAS asks whether to use sudo for ZFS commands, because the connection uses a non-root account. Click Use Sudo For ZFS Commands.

In Source, expand /mnt and the pool and select the dataset you want to replicate. Select Recursive if you also want to replicate its child datasets. If the dataset has no snapshots yet, the wizard shows that snapshots will be created automatically. TrueNAS creates a periodic snapshot task for the dataset, and you can see it later in the Periodic Snapshot Tasks widget.

In Destination, expand the tree of the destination server and select the backup dataset. Then add a name for the replicated dataset after a slash, for example tank/backup/data. TrueNAS creates this dataset during the first run.

Keep SSH Transfer Security set to Encryption and make sure Use Sudo For ZFS Commands is selected.

The Task Name field is filled in automatically. You can change it to something that is easier to recognize in the list. Click Next.

When

In Replication Schedule, keep Run On a Schedule. In Schedule, select how often to replicate. The default is Daily At 00:00 (12:00 AM). For important data that changes often, choose a more frequent schedule.

In Destination Snapshot Lifetime, choose how long to keep snapshots on the destination server:

  • Same as Source: uses the snapshot lifetime set in the source periodic snapshot task;
  • Never Delete: snapshots are kept until you delete them manually;
  • Custom: snapshots are kept for the period you set, for example 2 weeks.

Keeping snapshots on the destination longer than on the source can give you additional restore points, but uses more space.

Click Save. The task appears in the Replication Tasks widget with the PENDING status.

Run and check the replication

To start the first replication without waiting for the schedule, click the three dots menu next to the task and select Run job. Click Continue to confirm.

The first run transfers the whole dataset and can take a long time, depending on the amount of data and the speed of the connection between the servers. Later runs transfer only the changes.

When the task finishes, its state changes to SUCCESS, and the Last Snapshot column shows the name of the sent snapshot. If the state is FAILED, click it to open the task log and see the error.

To check the result, open the web interface of the destination server and go to Datasets. Select the replicated dataset, for example tank/backup/data, and click View Snapshots in the Data Protection widget. The list shows the snapshots received from the source server.

Info

The wizard creates the task with the Destination Dataset Read-only Policy set to Set, so TrueNAS makes the destination dataset read-only after a successful replication. This protects the copy from changes that would break the next replication runs.

Restore data from the copy

To restore individual files, clone the snapshot you need as a new dataset on the destination server: go to Datasets, select the replicated dataset, click View Snapshots, expand the snapshot and click Clone To New Dataset. Then copy the files you need from the clone.

To copy the replicated dataset back, go to Data Protection on the source server, click the three dots menu next to the replication task and select Restore. Enter a name for the restore task and select where to put the restored data on the source server. TrueNAS creates a new replication task that transfers the data back from the destination to the source. The task has the PENDING status. Run it to start the restore.

Warning

Do not roll back the replicated dataset on the destination server to an earlier snapshot unless you really need to. A rollback can remove newer snapshots and break the snapshot history that the next replication runs depend on.

VAT

  • Other

    Ex. VAT

    0%
  • austria

    Austria

    20%
  • Belgium

    Belgium

    21%
  • Bulgaria

    Bulgaria

    20%
  • Croatia

    Croatia

    25%
  • Cyprus

    Cyprus

    19%
  • Czech Republic

    Czech Republic

    21%
  • Denmark

    Denmark

    25%
  • Estonia

    Estonia

    22%
  • France

    France

    20%
  • Finland

    Finland

    24%
  • Germany

    Germany

    19%
  • Greece

    Greece

    24%
  • Hungary

    Hungary

    27%
  • Ireland

    Ireland

    23%
  • Italy

    Italy

    22%
  • Latvia

    Latvia

    21%
  • Lithuania

    Lithuania

    21%
  • Luxembourg

    Luxembourg

    17%
  • Malta

    Malta

    18%
  • Netherlands

    Netherlands

    21%
  • Poland

    Poland

    23%
  • Portugal

    Portugal

    23%
  • Romania

    Romania

    19%
  • Slovakia

    Slovakia

    20%
  • Slovenia

    Slovenia

    22%
  • Spain

    Spain

    21%
  • Sweden

    Sweden

    25%
  • USA

    USA

    0%
european
states
  • germany
  • Español
  • Italiano
  • Poland
  • Русский
  • Slovenski
  • Türkçe
  • ukraine
  • kingdom
  • French
  • Hrvatska
  • Other
  • Austria
  • Belgium
  • Bulgaria
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Hungary
  • Ireland
  • Italy
  • Latvia
  • Lithuania
  • Luxembourg
  • Malta
  • Netherlands
  • Poland
  • Portugal
  • Romania
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • USA