[Gllug] Raw LVM vs. LVM on partitions for KVM

Richard Jones rich at annexia.org
Thu Oct 14 15:32:05 UTC 2010


On Wed, Oct 13, 2010 at 08:10:21PM +0100, j.roberts wrote:
> Since the question of partitions and LVM has recently been 
> comprehensively touched upon, I'd like to ask for comments on whether I 
> am doing something stupid, and what the downsides may be.
> 
> I am evaluating (for production) a KVM instance running (inter alia) a 
> small XP farm with less than 20 instances.
> 
> This is for the usual sort of reason: currently critical software at the 
> client with dependency on XP and that won't run on Vista or 7 (sigh). 
> This is supposed to be rewritten - in the next 3 years.
> 
> After much messing around with trying to get aligned partitions (qv lots 
> of stuff elsewhere)

I'm supposed to be writing an alignment tool called virt-align:
https://bugzilla.redhat.com/show_bug.cgi?id=634649

If you're running XP guests, then unless you took extra steps during
the install the guest filesystems will not be aligned correctly.  XP
defaults to placing its C: filesystem starting at sector 63.  Try:

  fdisk -u=sectors -l /dev/GuestVG/Guest1

[The guestfish equivalent command would be this, which shows byte
offsets:

  guestfish --ro -a /dev/vg_pin/Win7x32 run : part-list /dev/sda
]

> I have now built a whole lot of VMs directly on LVM 
> directly on (hardware) RAID (5 as it happens), NOT building a partition 
> first.

If I understand you correctly, you are creating the PVs directly
on the RAID device, something like:

  pvcreate /dev/sdb
  vgcreate GuestVG /dev/sdb
  lvcreate -n Guest1 -L 10G GuestVG

This is fine, but it has nothing to do with alignment since you can
create aligned partitions easily enough with the right tools.  You may
prefer it for ease of use though, since partitions are just getting in
the way here.

> I did this to get around alignment issues, but it seems to be very 
> satisfactory.
> 
> The downside so far to doing this with Windows is that I can't use Linux 
> tools to check the VM's consistency etc; with Linux this is not an 
> issue. I can only run consistency checks within the VM using Windows tools.

Not exactly sure what you mean by "consistency checks", but very
likely that libguestfs can do this.

> It's not a huge problem since the images are largely static and so I can 
> use (backed-up) revertible snapshots to recover from catastrophic 
> failure or corruption.
> 
> However, I'd like to ask if anyone else is doing anything like this and 
> whether there are any other downsides that have not occurred to me (and 
> no doubt should have!). If you think I don't quite know what I am doing 
> I'd probably agree :)

You've not placed guests directly on host block devices, so you've
avoided the big security hole.  If it works, looks good to me.

Rich.

-- 
Richard Jones
Red Hat
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list