LVM only allows volume groups to be expanded by adding physical volumes. So if I have multiple volume groups which may need extra space, but it can't be predicted which will expand fastest, it's best to have several spare physical volumes available to allocate. If I am using MD raid arrays to provide physical volumes, what is the best way to set these up?
For example, assume I have 3 1Tb drives. I want to create 2 volume groups, each initially 500GB, with the option of extending either by another 500Gb at a future date,
As I see it, there are two choices:
- Multiple raid arrays - The disks are each divided into four partitions, each partition being 250Gb in size. Four raid arrays, each 500Gb, are then assembled using these partitions (e.g.
mdadm /dev/md0 -create -lraid5 -n3 /dev/sda1 /dev/sdb1 /dev/sdc1,mdamd /dev/md1 -create -lraid5 -n3 /dev/sda2 /dev/sdb2 /dev/sdc2etc. One raid device is then used as the initial physical volume for each volume group. The remaining 2 spare raid devices can be added to whichever volume group may need it in future. - Partitioned raid device(s) - In this case, a single 2Tb raid device is created. This is then partitioned into 4 500Gb partitions (
/dev/md0p1/dev/md0p2/dev/md0p3and/dev/md0p4. These are then used as the physical volumes as above, i.e. initially assign one to each VG, etc.
Obviously, there is some overhead in terms of disk space when creating multiple partitions, but this will probably be very similar for either configuration and is negligible compared to the size of the volumes.
However, is there any processing or performance overhead to using partitioned raid devices?
I've always used the first configuration and only recently considered (and experimented with) the second. I haven't noticed any difference but does anyone has any long term experience of this or can point to technical reasons why one configuration is preferred or deprecated?
pvsto select a device with the amount of space you want to move,pvmoveany extents off it,vgreducethe source VG, thenvgextendthe one you're wanting to add the volume to. I would think partitioning anmddevice would only be useful if they were local disks or negotiating with your SAN team was so time consuming you wanted to just request big volumes up front and use them for all your storage needs.