Saturday, March 4, 2017

Moving a zfs pool from one disk to another

If we want to move a zfs pool with their full layout from one disk to another we can use the following approach

zfs snapshot -r pool_A@migrate
zfs send -R pool_A@migrate | zfs receive -F pool_B

zfs unmount oldpool/myfilesystem

And take a new snapshot.

zfs snapshot oldpool/myfilesystem@snapshot2

you can now do an incremental send of the difference between the two snapshots which should be very quick.

zfs send -i oldpool/myfilesystem@snapshot1 \
             oldpool/myfilesystem@snapshot2 | zfs receive newpool/myfilesystem