Creating Raid1 LV

Hi, It would be really nice to be able to choose to create a raid1 LV to store a lxc container.

It's a matter of adding the --raid1 to the lvcreate call. Underlying VG must have 2 PV of course.

This would be more efficient and flexible than to oblige to set up beforehand a LVM over RAID1 disk setup.



I didn't know about that flag - it just splits the LV across two PVs rather than using "real" Linux RAID though?

Yes, absolutely. In fact LVM allows you to create any RAID type given the minimum number of PV are presents in the VG. It even does auto-allocation based on remaining disk space if there is more PV than needed. I personnaly use it mostly for RAID1 LV for redundancy but you can do RAID0 or 5.

This is a very neat feature since it gives you a lot of flexibility to choose at creation time if you need RAID or not and which kind, and it avoids the overhead of handling RAID separetely.

Also you can modify the kind of RAID you want on a live LV, like moving it to a RAIDn or lowering the RAID level. This can even be used as a duplication feature to move an LV from a storage to another : RAID1-ing a LV, then un-RAID it while keeping the PV you choose.

Note that LVM makes use of kernel md code to handle raid operations, so one can expect the same kind of robustness than from usual mdadm operations.

That's why I think it would be real great if Cloudmin could take advantage of this.