ZFS How should I extend a ZFS partition after cloning a drive to a larger drive?

Avery Freeman


Reaction score: 15
Messages: 67


I have a 120GB drive using ZFS that I'm cloning to a 300GB drive since I know I will outgrow it soon.

It just dawned on me that I've never extended a drive using ZFS before.

Partition 1) EFI (512MB)
Partition 2) ZFS data + OS root (111GB)
Partition 3) Not sure (15GB) maybe left over from the last OS that was on the drive?

I think I can safely delete the 15GB partition at the end, but either way, what's the process I should use to extend the drive using ZFS?

Thank you,



Reaction score: 1,217
Messages: 2,256

You do better installing FreeBSD (assuming it is on the old drive) on the new drive, and then use the zfs send | zfs recv feature to stream the data from the old drive to the new one.


Staff member

Reaction score: 10,991
Messages: 36,924

All you need to do is to enlarge the freebsd-zfs partition. Then turn on the autoexpand property of the zpool. Nothing else should be needed to be done. Note however that this is quite dangerous as changing an existing partition could go seriously wrong so make sure you have proper backups. Just in case.


Staff member

Reaction score: 1,285
Messages: 4,099

If you have room in the computer for both drives, then you can partition the new drive however you want, "zpool attach" the freebsd-zfs partition to the existing partition in the pool to create a 2-drive mirror, let it resilver, then "zpool detach" the old drive. If autoexpand is enabled, the extra space will just appear in the pool. If not, "zpool online -e" can be used.

See the man page for zpool for more details.

Be sure to install the boot code/EFI into the correct partition(s) on the new disk.