22 Mar
22Mar

We recently embarked on a lab project to migrate from 8x 4TB HDDs to 4x 16TB HDDs. Based on our experience and questions we encountered on Reddit, we decided to share a write-up on the process.

Hardware Setup

Our NAS has 8 physical bays with no extra space to add the new drives. To work around this limitation, we purchased a 4-Bay Hard Drive Enclosure (DAS – Direct Attached Storage) with USB-C & 10 Gbps Speed.

Using this DAS, we were able to:

  1. Attach the new drives to the TrueNAS appliance using a USB-C to USB-A 3.0 cable (connecting the DAS to the motherboard's internal USB 3.0 header).
  2. Create a new ZFS RAID on the new drives.
  3. Transfer data using ZFS snapshot replication via a TrueNAS Replication Task.

Setting Up ZFS Snapshot Replication

Important: Two datasets cannot share the same name. If a dataset named data already exists, name the new one data_2 (or something else temporarily).


When configuring Replication Task/ZFS snapshot replication, pay close attention to the "Destination Dataset Read-only Policy" setting to avoid issues later. Here’s a breakdown of the available options:

  • SET – Changes all destination datasets to readonly=on after replication completes.
  • REQUIRE – Stops replication unless all destination datasets have readonly=on.
  • IGNORE – Disables read-only property enforcement during replication.


In our case, we overlooked this setting, and after transferring the data, we realized the dataset was stuck in read-only mode.To fix this, we had to:

  1. List the ZFS datasetsto get their names:
    shzfs list
  2. Disable the read-only flag for each dataset. Assuming the pool is named data with datasets backups and binaries:
    shzfs set readonly=off data
    zfs set readonly=off data/backups
    zfs set readonly=off data/binaries

Additionally, before renaming or switching pools, disable all externally available services like:

  • SMB
  • NFS
  • iSCSI

Finalizing the Migration

  1. Complete a final replication pass to ensure all data is up to date.
  2. In TrueNAS UI:
    • Go to Storage → Export/Disconnect and remove both datasets.
  3. Physically disconnect the old drives and connect the new ones.
  4. Rename the new dataset from data_2 to datavia the shell:
    shzpool import data_2 data
  5. Export the new pool:
    shzpool export data
  6. Re-import it using the TrueNAS UI (Storage → Import Tool).


This method allowed us to seamlessly migrate data from the old drives to the new ones using TrueNAS replication. By ensuring proper replication settings and handling dataset renaming correctly, we avoided downtime and maintained all shares and configurations.


Let us know if you have any questions or need any assistance with your Company's IT infrastructure or Business Processes, thanks!

Comments
* The email will not be published on the website.