User Tools

Site Tools


freenas:pool:migrate_a_raid-z1_vdev_to_a_raid-z2

FreeNAS - Pool - Migrate a RAID-Z1 vdev to a RAID-Z2

The easiest method is to set up a second FreeNAS which is setup with a RAID-Z2 and copy everything to it.

However if that is not possible, following steps can be taken.

NOTE: Assumption is that:

  • TANK: is the primary dataset name.
  • TEMP-TANK: is the name for the new pool prior to data migration.

The steps are:

  • Replicate from TANK to TEMP-TANK.
  • Remove (or rename) TANK.
  • Rename TEMP-TANK to TANK.

In essence this means:

  • Copy the data off the pool using ZFS to preserve all the file permissions and everything.
  • Destroy and recreate the vDev and pool.
  • Move everything back as it was.

Save the System Configuration

Take a backup of the system configuration.

Navigate to System.

  • Select the General tab.
  • Click Save Config.

NOTE: This backup will be needed later, because when TANK is detached, this will lose any share, snapshot and replication settings.


Move the System Dataset

The system dataset needs to be moved off of TANK.

Use the GUI to select a new location other than TANK or TEMP-TANK.

Plug a USB drive into a free USB port.

Navigate to Storage → Pools.

  • Click Add to create a new pool.

NOTE: The name does not matter.

In this example, it is called sysbackup.

After the new pool is created

Navigate to System → System Dataset.

  • System dataset pool: Select the new pool.
  • Syslog: Checked.
  • Reporting Database: Not Checked.
  • Click Save.

NOTE: After a while, the System Dataset will be on the new pool.


Create the Backup Pool

Navigate to Storage → Pools.

  • Click Add to create a new pool.

NOTE: The name does not matter.

In this example, it is called backup.


Backup the Data Pool

Create a snapshot of the root dataset on the pool to backup.

Navigate to Storage → Pools.

  • Select your root dataset.
  • Click the 3 dots.
  • Select Create Snapshot at the bottom.
    • Name: A simple name. In this example the name migrate is used.
    • Recursive: Checked.

NOTE: An alternate method to take a snapshot is through the CLI.

Open an SSH session to your FreeNAS box as root.

zfs snapshot -r tank@migrate
zfs send -R tank@migrate | zfs receive -F backup
  • tank: the name of the volume being backed up.
  • migrate: the name of the snapshot.
  • -F: allows overwriting the existing pool that FreeNAS created when you created the backup pool.
  • backup: The new pool created earlier.

This takes a very long time, often hours.

It is recommended to keep the SSH session open until the command completes

It does not give you any info on the progress of the command, but you can check how much data has been written through the normal reports in the Web GUI.


Verify that all the data has been successfully backed up

All the data should be on the backup pool.

IMPORTANT: Verify this before continuing.


Destroy and Remake the Data Pool

Detach the old pool

Navigate to Storage → Pools.

  • Select the old pool (in this case tank).
  • Click the 3 dots.
  • Select Detach at the bottom.
  • Select Destroy, and do not delete the shares.
  • Click Save.

ALERT: This will completely delete all you data on the pool with no chance of recovery!

It is highly recommended that in addition of the backup pool just created, that another copy of the data is saved elsewhere.

The pool only needs to be destroyed if some of the old drives will be reused.


Create the replacement pool

Pull the old drives, and replace with different drives if needed.

Creating the new pool tank as a RAID-Z2 vdev.

Navigate to Storage → Pools.

  • Select Add.

NOTE: Ensure this is named the same when you recreate it.


Move the Data Back

SSH in.

Run the copy command in reverse.

zfs send -R backup@migrate | zfs receive -F tank

NOTE: This may take a very long time, often hours.


Export and Import the New Pool

In the GUI.

Navigate to Storage → Pools.

  • Select the new tank
  • Select Detach.

NOTE: Do not select destroy this time!

By releasing the tank, and importing it again, will result in the pool being re-inventored.

  • Select Import Volume
  • Import tank again!

Restore the system dataset

Move the system dataset back to the main pool.

NOTE: If the system drive was used for this backup instead of a separate USB drive, you can skip the detachment steps below.

The steps are exactly the same as in step 2, just select tank instead.

Navigate to System → System Dataset.

  • System dataset pool: Select the new pool.
  • Syslog: Checked.
  • Reporting Database: Not Checked.
  • Click Save.

NOTE: After a while, the System Dataset will be on the new pool.


Detach the sysbackup pool

After the system dataset is moved back, detach the sysbackup pool, no need to destroy it, and remove the USB flash drive.

NOTE: Everything should be fine.

If not then restore the system configuration.

  • The process is the same as in step 1, you just need to select Upload Config instead.
  • The system will reboots two times, and everything should be back to normal.

freenas/pool/migrate_a_raid-z1_vdev_to_a_raid-z2.txt · Last modified: 2023/06/18 20:33 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki