Linux – Expanding RAID6 with LVM

linuxlvmraid6

My question is a bit broader than the question title, but here is my situation: I have Synology Hybrid Raid (SHR) built on 2 x 2TB drives. I want to migrate to a software-RAID on a homegrown linux machine. My current plan is backup the SHR remotely, setup a RAID6 with LVM using 3 x 2TB drives, and then restore the backed-up directories to the new RAID.

In the future, if I want to add more drives, is it possible to dynamically expand the RAID6? Are there any good articles explaining the relationship between RAID6 and LVM? This machine will be for my own person use and limited web traffic, so drive fault tolerance is more important to me than speed.

Best Answer

You can create the RAID like this:

lvcreate --type raid6 --stripes 1 -L 1T --name MyRaidLV MyVG

--stripes 1 is the number of disks aside from RAID6's two redundancy disks, -L 1T is the visible size of the raid array. Then you can expand the raid with lvextend -L +1T, or add disks with

vgextend MyVG $NewDiskOrPartition
lvconvert --stripes 2 MyVG/MyRaidLV

The relationship between LVM and mdraid is basically that the kernel side is mdraid, and the management commands are LVM. The relevant commands are described in this documentation and in man pages.