Linux – Migrate LVM to ZFS

linuxlvmmigrationzfs

I am currently thinking about moving away from my LVM setup to a ZFS setup with RAIDZ.
My current setup consists of 5 x 4TB disks in a LVM and a 60GB SSD for the system.
At the moment there is about 6TB used on the LVM.

Is there a way, without completely backing up the 6TB, to migrate the LVM to a RAIDZ setup with 4 + 1 drives?
Kind regards

Lukas Häfliger

Edit: I did some research and the main problem I encountered was, that when creating a RAIDZ you need to have all disks available. The only possibility I saw was to create a RAIDZ with 3 HDD's, then moving all data from the LVM into this raid and then extending the ZFS pool with 2 single vdevs. Big disadvantage is that the 2 last HDD's are not "protected" by the raid system.

Best Answer

The short answer is no - there is no direct migration path for LVM -> ZFS. Your research leads you down the right path - you'll need 3 additional drives, create the zpool with those drives, use something like rsync to copy the data over, then add the existing drives to the zpool. If you're concerned about data protection, you could put the two remaining drives in a mirror, so you'd have a pool with a raidz and a mirror. This isn't really ideal, and does not get you to the 4+1 RAIDZ config, but it does at least utilize the disks.

If you really want the 4+1 config, then you'll probably need to find a way to attach a couple of the existing disk drives to the system externally - USB or something like that - then add a couple more 4TB drives to the system, build the pool, and migrate the data using rsync.

Also, with LVM, be careful that you know exactly which disks your data is located on before you start removing them, and make sure you use the commands in the right order. LVM has 'pvmove' to make it easy to dynamically move data off of disks and onto others, so as long as you're using that you should be good.

Related Question