[CentOS-virt] Slightly OT: Centos KVM Host/Guest functions and LVM considerations

Chris Wik

chris at anu.net
Wed Sep 14 20:41:15 UTC 2011

On 14.09.2011, at 18:51, Jeff Boyce wrote:

> The primary function of my new server hardware will be as the Samba file server for the company.

I would put this in a VM. Use the dom0 (or whatever it is called in KVM terminology) purely for managing hardware and virtualization, don't put anything else there.

The main reasoning for this is that a compromise (hack) on dom0 would provide access to all your VMs. A compromised VM has no access to dom0 or other VMs. Less services on dom0 = less chance of successful attack.

>  It may also provide all, or a subset of, the 
> functions my existing server provides.  I am considering adding a new 
> gateway box (ClearOS) to my network and could possibly move some functions 
> (FTP, VPN, etc.) to it if appropriate.

VPN is probably a good thing to move there, depending on how your network is configured of course. Not sure why you would put FTP there, but you probably have your reasons.

>  There are also some new functions 
> that my server will probably be responsible for in the near future (domain 
> controller, groupware, open calendar, client backup system [BackupPC]).

I would put these all inside virtual machine(s).

> I have never worked with LVM yet, and I am trying to understand how I should 
> setup my storage space and allocate it to the host and any guests.

My recommendation would be to use LVM on the whole disk, with a small partition for your dom0 OS. This gives you maximum flexibility to change things later on.

>  I want 
> to use LVM, because I see the many benefits it brings for flexible 
> management of storage space.  For my testing guest VM I would probably use 
> an image file, but if the Samba file server function is in a guest VM I 
> think I would rather have that as a raw LV partition (I think?).

With LVM, you can mount a LV on your dom0 and put an image file in it, or you can connect the VM directly to your LV. See the flexibility it gives you?

Personally I would attach the VMs directly to logical volumes, but this is a personal preference and is what I'm comfortable with. As you have discovered, there are dozens of ways to achieve the same goal and not one of them is the "right" way!

>  The more I 
> read the more confused I get about understanding the hierarchy of the 
> storage (disks.RAID.[PV,VG,LV].Partition.Image File) and how I should be 
> looking at organizing and managing the file system for my functions.  With 
> this I don't even understand it enough to ask a more specific question.

Some examples might help. This is what I do:

Disks -> RAID -> PV -> VG -> LV -> VM filesystem /
Disks -> RAID -> PV -> VG -> LV -> VM filesystem /boot
Disks -> RAID -> PV -> VG -> LV -> VM filesystem swap

I like this method because it makes it easy to take a snapshot of the VM filesystem and run a backup from dom0 (yields a consistent backup with no interruption to the running VM)


Disks -> RAID -> PV -> VG -> LV -> VM's partition map -> VM filesystems (/, /boot, swap, etc)


Disks -> RAID -> PV -> VG -> LV -> VM's partition map -> PV -> VG -> LV -> VM filesystems

Which setup you choose depends on how much flexibility you want, and whether you want to manage LVM inside the VM or not. LVM inside the guest allows more flexibility inside the VM...


Chris Wik
Anu Internet Services Ltd
www.cwik.ch | www.anu.net

More information about the CentOS-virt mailing list