LVM – spanning single VG across multiple PVs

lvm

while configuring a small-business server (CentOS 6.4) I came across a doubt that I have regarding LVM managing and I was hoping you can help me clarify.

The machine has the following storage setup:

3x 146GB SAS of which 2 must be raid1 (software raid, resulting in md0) and the remaining drive will host the running system.

Using LVM, I'd like to have a single VG (VG00 for example) which can use two PVs: sda0 (the non-raid drive) and md0.
Assuming that I create a new LV under VG00, is there a way to decide which PV has to be used for that specific LV?

In short, how can I get the new LV to write its data only on the raid1-PV (md0) rather than sda0 (system drive)?

example:

LVhome with mount point /home — on md0

LVtmp with mount point /tmp — on sda0

LVvar with mount point /var — on sda0

I believe that by default LVM will use striping within sda0 and md0, is this right?

Thanks to anyone who can lend me a hand!

Matthew

Best Answer

Yes, a VG can span multiple PVs.

However it is recommended that you not span PVs with different performance characteristics (e.g. two types of RAID) as the performance of that particular PV becomes unpredictable - you can try to force particular LVs to specific PVs using lvcreate (vgname) (size) (pvname) but that is not a preferred option - you still risk losing data if that particular disk dies.

If this really is a production system, there is no reason why any disks shouldn't be in a RAID level that provide protection against single disk failure (at least) or worse, depending on your capacity, budget, and required availability of that machine.