ZFS Migrating zpool to new drive

I have M.2 SSD that is currently not performing well, I suspect that it may die soon. The question is - how do I migrate zpool to a bigger drive? Of course I will make dd backup before anything.

Do I just dd it on new drive, then how do I expand zfs pool?
Or perhaps, using zfs send to replicate filesystem on new pool, but then comes another question: there is zroot/jails dataset with children datasets for each jail filesystem, I have enabled dedup on zroot/jails. Will dedup transfer on new zpool via zfs send?

What's the best strategy using zfs send to migrate everything to new pool?
And what do I need adjust after, so that my FreeBSD 14.1-RELEASE boots from new pool? As far as I see, a new EFI boot entry must be created from install media live shell. Then, how do I tell the FreeBSD bootloader than new root pool's IDs and such?
 
DDing the whole drive. If you have GPT partition tables nuke the table and recreate the partitions with the same block boundaries.

If you data partition is the last one you can just recreate the partition table entry with a new end sector, and then set autoexpand in the zpool.

Quite easy as long as you aren't stubborn like me and try to reuse the old GPT table...
 
You could attach the new drive to the system (withe a suitable external enclosure, if necessary.) Then, after doing any partitioning you need, just do zpool replace .... and wait for the operation to finish. Depending on your pool properties you need to do zpool online -e to make the added capacity available.

Although I always found this operation to be very reliable, you should have a bootable live system ready. Some uefi bioses seem to get very confused with the old drive gone and need a little kick with efibootmgr. Most of the time it just worked for me if the uefi boot loader just is present in the proper location.

A variation would be to add the new drive as a mirror and do zpool split. Proceed from there.
 
You could attach the new drive to the system (withe a suitable external enclosure, if necessary.) Then, after doing any partitioning you need, just do zpool replace .... and wait for the operation to finish. Depending on your pool properties you need to do zpool online -e to make the added capacity available.

Although I always found this operation to be very reliable, you should have a bootable live system ready. Some uefi bioses seem to get very confused with the old drive gone and need a little kick with efibootmgr. Most of the time it just worked for me if the uefi boot loader just is present in the proper location.

A variation would be to add the new drive as a mirror and do zpool split. Proceed from there.
zpool replace... damn thats clever!
 
DDing the whole drive. If you have GPT partition tables nuke the table and recreate the partitions with the same block boundaries.

If you data partition is the last one you can just recreate the partition table entry with a new end sector, and then set autoexpand in the zpool.

Quite easy as long as you aren't stubborn like me and try to reuse the old GPT table...
Thanks! That's gonna do it! GPT is quite hard when dd'ing since it has its structure in beginning of disk and also in the end. Recreating GPT table with same block boundaries and expanding it then will do it. Didn't knew that it's possible to expand zfs partition
 
Depending on your specific hardware, if your existing zpool is a single device, you could physically add a new device, partion it and then create a mirror from the old device and new device. ZFS then resilvers everything, when done new device should be same as old. Then break the mirror, remove the old device and the new device should be good.
I think this is roughly/similar to the what is proposed by adorno
 
Back
Top