Many Linux users have created RAID arrays using mdadm commands and do not realize that you can also create a RAID through LVM.
Steps
Installing LVM
You may need to install the LVM packages in order to build these arrays.
Creating RAID 0
- Stripe size needs to be a number of the power 2, starting with 4. E.g. 4, 8, 16, 32, 64. If your data is mostly small text files, then use 4. If you are mostly dealing with media then you may want something larger.
- If you want to use the xfs filesystem, you may need to install xfprogs with
sudo apt-get install xfsprogs -y
Creating this RAID array will remove the ability to remove a drive from the VOLUME group later.
Creating RAID 1 (Mirror)
Creating RAID 5 (Parity)
Scrubbing
If you have any type of raid other than RAID 0, then you can scrub the data every now and then to prevent bitrot.
Extra Info – LVM Is Using md Under the Hood
As Felipe Franciosi points out in the comments, configuring as above will still use “md” behind the scenes. It just saves you the trouble of using “mdadm”.
You can confirm that by identifying the device mapper setup by lvm with:
It will show you that the driver “raid” is being used. Then, from dmsetup(8), you’ll see:
“raid Offers an interface to the kernel’s software raid driver, md”
For more information on LVM and MD RAID, please refer to this unix & Linux post.
References
https://blog.programster.org/create-raid-with-lvm