Abstract physical drives to create a resizable raid array: is it possible?

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.


Solution 1:

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.