How to replicate an encrypted dataset to an existing encrypted dataset

:waving_hand: Hi, everyone.

For years, even before switching to TrueNAS OS, I replicated folders using rsync. To consolidate all my replication tasks, I decided to switch everything over to the TrueNAS replication system.

I have a very large media dataset that I’d like to replicate without deleting the existing files, so I don’t have to start from scratch and can save time and resources. My source dataset and my destination dataset are both on different pools on the same machine. Each dataset is encrypted and inherits the parent’s encryption.

Despite all my attempts, I can’t get replication to work.

  • I tried re-encrypting my destination dataset with the key from my source dataset
  • I tried disabling the “Include Dataset Properties” option and letting my destination dataset inherit encryption from its parent
  • I tried enabling the “Encryption / Inherit Encryption” option
  • I even tried enabling the “Replication from scratch” option

I get one of the following errors:

Destination dataset ‘destination_pool/destination_dataset’ already exists and is its own encryption root. This configuration is not supported yet. If you want to replicate into an encrypted dataset, please, encrypt its parent dataset.

Unable to send dataset ‘source_pool/source_dataset’ to existing unrelated encrypted dataset ‘destination_pool/destination_dataset’

Am I doing this wrong? What advice do you have?

Was the destination dataset already created and populated before trying this?

For ZFS replication to work, the destination must be created by the replication the first time you run a replication from the source. You must start from scratch. Unlike the file-based rsync, ZFS replications are block-based.

Hi @winnielinnie, thanks for your super-fast reply!

Yes, the destination dataset has been around for a few years now, and the files are synced to it every night using rsync via a cron job.

So, I have no choice but to delete this existing dataset and all its data and create a new one to start a replication…

You wouldn’t create a new one. You would let the replication create the new destination dataset the first time it runs.

True TrueNAS UI does not make this obvious. When you select the destination dataset, you must also manually type in /mydata at the end of the path in the text field. If you select mypool and expect it to nest the target one level below, it will not. You need to manually type it so that it looks like this: mypool/mydata.

If you want it to preserve the same encryption and key, you need to select either “Include Dataset Properties” or “Full Filesystem Replication” for the source side, and also disable the “Encryption” option for the destination side.

Thanks you @winnielinnie for the advice!

So, I deleted my old backup dataset and started a new replication job. The process is now complete! :tada:

Don’t forget to keep “Replication from scratch” disabled in your replication settings or else you risk starting all over. It’s better for it to fail so that you can investigate why, rather than to wipe your destination and start all over again.

It’s all right, I’ve definitely disabled that option!
:folded_hands: Thanks for pointing that out. The community on this forum is really helpful, this is so great!