If you're going to use a Linux box for Red Hat-style virtualization (Xen/KVM), how should you use/partition your disk(s)? Here's one answer.
First: disks are cheap enough that I always use two, and software-RAID-1 them together (mirroring). Plan to do that.
Second: Though I'm no fan of LVM (the Logical Volume Manager) -- extra complication for no gain -- it's a good choice for "host for a bunch of VMs (virtual machines)". I'm assuming you don't know exactly which VMs of what size, so the flexibility of LVM is actually useful.
Also, as disks get larger, it's harder to predict in advance how you'll end up using all that space. So, again, the flexibility of LVM may benefit.
Now, I don't use LVM for the basic filesystems (/boot and / [root]).
Their sizes are predictable and, when It Goes Horribly Wrong (TM),
you'll be really glad not to have LVM in the way. So I partition
my raw disks thusly:
Filesystem Size Used for
/dev/md0 300M /boot
/dev/md1 16G /
swap ???
/dev/md2 rest of the disk(s)
That /dev/md2 goes straight into LVM. Make a PV (Physical Volume):
pvcreate /dev/md2
And create a Volume Group (let's call it vg0) with it:
vgcreate -s 32M vg0 /dev/md2
(That -s 32M is not particularly well-informed.)
Now you can make LVs (Logical Volumes) to your heart's content...
lvcreate -n vm001-disk --size 10G vg0
... and feed them to your VM-creating software. (Or make things
for your host machine, e.g. a varying-sized /var.)
A word on LVM-on-RAID... LVM has a mirroring facility of its own, so why use software RAID1?
First, I'm already paying the software-RAID tax with my non-LVM
partitions (/boot and /).
Second: For me, software RAID is familiar and has been reliable.
Third: Software RAID-1 is less scary in a crisis. I like things like: You can take a disk that is half of a RAID-1 mirror, throw it in an enclosure, and mount it as a filesystem, no problem.
Fourth: The LVM mirroring guff seemed more complicated and/or easier to get wrong. (Just unfamiliarity, maybe.)

Leave a comment