2

I want to set up two hard drives with a portion of them set in raid1. I want that portion to be scalable too, as logical LVM volumes are. Is it possible to abstract physical volumes or to create an array based on logical volumes?

I'm thinking about something like nested LVMs.

3
  • Next to that, you can create raid arrays from lvm logical volumes, too. Nothing prohibits that, although it is a little bit uncommon (and raid autodetection isn't the best on it too).
    – peterh
    Dec 18, 2014 at 9:43
  • Thank you for your answer, aren't LVs treated like partitions and not physical drives? I thought that raid would only work with physical disks Dec 18, 2014 at 9:44
  • Linux software raid works between block devices, if they are partitions, physical disks, logical disks, or even ramdisks, it doesn't matter. This is the main ground behind my heretic opinion, that the so-named hw raids never could reach the flexibility of the linux software raid.
    – peterh
    Dec 18, 2014 at 9:47

1 Answer 1

2

I know you can do the following in Linux LVM and can only assume that it may be possible on other OS's:

Use the Volume Manager to set up your redundancy and data striping for reliability and performance.

Simply use both disks as physical volumes for a LVM volume group and create a LVM logical volume with the correct redundancy and striping when setting up logical volumes.

-m, --mirrors Mirrors Creates a mirrored logical volume with Mirrors copies. For example, specifying -m1 would result in a mirror with two-sides; that is, a linear volume plus one copy.

So for example the commandline lvcreate -m1 -L 10G -n <name> <volume_group> would create a mirrored logical volume or the equivalent of a RAID1 array.

-i, --stripes Stripes Gives the number of stripes. This is equal to the number of physical volumes to scatter the logical volume. When creating a RAID 4/5/6 logical volume, the extra devices which are necessary for parity are internally accounted for. Specifying -i3 would use 3 devices for striped logical volumes, 4 devices for RAID 4/5, and 5 devices for RAID 6.

If you have three disks 2 would be the maximum number of stripes (the third is for parity) and lvcreate --type raid5 -i2 -L 20G -n <name> <volume_group> would set up the equivalent of three disk RAID5 array.

4
  • Thank you! That's what I need. I didn't know about the mirroring option in LVM. Unfortunately, I can't even upvote you since I don't have enough points :( Dec 17, 2014 at 19:20
  • @InfiniteSnow: marking the answer as accepted if nothing better comes along is enough. And please don't cross-post on multiple Stack Exchange sites please.
    – HBruijn
    Dec 17, 2014 at 19:23
  • Was waiting to be enabled to do it, had to wait 5 minutes. Is cross posting a frowned-upon practice? I have deleted the other question. Dec 17, 2014 at 19:26
  • @InfiniteSnow The idea is that if your question is off-topic on one site it can be moved to a more relevant one. Thanks for accepting the answer and hope to see more of you!
    – HBruijn
    Dec 17, 2014 at 20:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .