Is it sensible to use multiple LVM layers with mdraid

I’m building up a home server that will be used for a handful of different things. I’d really like to try a Btrfs raid 1 array for a large data store, but I’m using CentOS 7 (older kernel although it’s said to be stable by 3.10), and have some general concerns about its stability and my ability to fix problems should they arise, so I’ve decided to stick with ext4 on MD RAID 1 (for now). However, I’d like to keep it flexible enough to maybe transition later. It seems to me the simplest way to do this would be to have MD running on top of one logical volume per disk so I can more easily adjust the overall raid size over time, then put additional logical volumes on top of that to manage disk usage for various things. (I suppose I could use LVM raid, but I’m leaning against it for reasons listed here: RAIDing with LVM vs MDRAID )

Something like this for example:

| /share | /userX | /userY | /media |
 -----------------------------------
|  LVM1  |      LVM2       |  LVM3  |
 -----------------------------------
|           RAID 1 Volume           |
 -----------------------------------
|    LVM volume   |    LVM volume   |
 -----------------------------------
|      Disk 1     |     Disk 2      |

That would allow me to flexibly manage the disk usage at the top level as well as manage the overall RAID size, so I could in theory eventually start using extra disk space for another system, no?

I get the feeling I’m missing something- Performance penalties? Too complex? Plus, this question makes me doubt my approach, though that poster appears to be doing something slightly different. It’s not like I’m going to be storing nuclear codes here, and I’ll have offsite backups of important stuff, but I’d like to avoid shooting myself in the foot with a solution that could lead to issues.

Asked By: GP Hoit

||

Most init systems probably won’t expect this situation so they won’t be prepared to first assemble LVM, then MD, then LVM again.

If you put LVM below MD you have to be very careful. MD is supposed to be used with physical disks, but with LVs as RAID members you could easily end up with two members sharing the same disks. That is if using MD as a standalone layer, not the raid functionality of LVM itself, in the latter case LVM itself makes sure of this.

If MD members end up sharing disks, a single disk failure will end up killing more than one of your members. Basically you’d be running a pointless RAID without real redundancy.

The question is, what’s the point of such a setup? From your graphic alone it seems obvious that the additional LVM layer is superfluous. Just use the disks directly.

Most people who want to change their RAID1 setup to something else entirely just kick out one disk and build the new system on it. You temporarily lose redundancy for this process but you should always have backups anyway, right?

Most other advantages on LVM do not apply to RAID. You don’t need LVM below RAID in order to be able to grow or shrink the RAID. MD can do that well enough on its own.

Answered By: frostschutz
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.