[Gllug] Virtual disk allocation advice requested

Richard Jones rich at annexia.org
Sun Jun 29 14:54:45 UTC 2008


On Sun, Jun 29, 2008 at 11:31:59AM +0100, David L Neil Mailing list a/c wrote:
> Using a single large HDD initially, I thought:
> a) primary partition, <1GB, ext3, /boot
> b) LVM logical volume(s) for Xen's Dom0
> c) multiple logical volumes, one for each Xen DomU
> d) NFS shared space (both for network and between DomUs)
> e) Samba shared space (somewhat optional because have other such spaces)
> - that latter revealing that I have an heterogeneous network

My standard layout looks something like this:

  /dev/sda1     /boot     256MB-1GB
  /dev/sda2     Allocate all the rest of the space to a single LVM PV/VG

The only reason for the separate /boot partition is because grub
cannot understand LVM [When will this happen?  LVM isn't actually that
hard to parse].  For everything else, use LVM.

Within the PV, I would have something like:

  VolGroup/Dom0Swap       2 GB
  VolGroup/Dom0Root       At least 6 GB

ie:

  pvcreate /dev/sda2
  vgcreate VolGroup /dev/sda2
  lvcreate -L 2G -n Dom0Swap VolGroup
  lvcreate -L 6G -n Dom0Root VolGroup

Optionally you could have other Dom0 partitions, as required.

Then for each guest (eg. a guest called 'email') I would have:

  VolGroup/Email          At least 6 GB

ie:

  lvcreate -L 6G -n Email VolGroup

To the guest, VolGroup/Email will appear as a device (/dev/xvda) which
you can partition as required.  You can even use LVM-on-LVM, although
for guests there's probably not much benefit.  In Xen the maximum
number of devices supported per guest is 16.

> Queries:
> 1 would it make better sense to put all of the Dom0 onto the primary
> partition or even a separate extended partition?

It's just so much easier and flexible to use LVM for everything that I
would prefer LVM over extended partitions.  There are two major
reasons you might NOT choose LVM: (a) block sizes in LVM are much
larger than the granularity of partitions, so you'll waste a bit more
space, and (b) LVM imposes some performance overhead, depending on who
you talk to this can be negligible or anything up to 30%.  (a) isn't a
problem with modern disk sizes.  I've not observed (b) happening in
practice, but you may want to do some tests yourself.

> 2 for Dom0 I thought something like:
>  2GB, swap, /swap
>  5GB, reiser, /var
>  2GB, reiser, /root (rootuser)
>  10GB, ext3, /
> but is it as necessary to break things out in a Dom0 situation?

Jokes about murderfs aside, why use reiser instead of ext3?  I guess
it would only make sense if /var is storing newsgroups.  Also I'm a
bit confused as to why you've decided to use a separate /root
partition, since I wouldn't normally expect someone to store large
numbers of files under /root.

> 3 I thought to use LVM logical volumes for the DomUs for the inherent
> extensibility, eg one domain will be used to build an email server, and
> if the project is successful I would add another HDD; but would it be
> somehow better to use extended partitions?

See above.  No, LVM is much more flexible.

> 4 I haven't figured out where/when/how one allocates space within a
> DomU. Does/should one separate out space allocated to logs, the root
> user, etc, as we were advised in 'the good old days' or has such gone by
> the board/become irrelevant in the brave new virtual world?

I usually use a single root partition for guests (/dev/xvda1 = /boot,
/dev/xvda2 = /)

> 5 will NFS 'play nicely' in an LVM logical volume or should it be an
> extended partition?
>
> 6 similarly will Samba go into an LVM logical volume or should it be an
> extended partition?

NFS can use anything.  Use an LVM logical volume by choice.  A more
interesting question is where should you run the NFS / Samba server?
In an ideal world you would run it inside a guest, so that the dom0 is
protected from NFS server security problems, but in reality this is
very slow, so it's best to run these servers in the dom0.

> 7 if I set up a DomU temporarily, eg to test some software/project, and
> subsequently discontinue it, should I also remove the partition/virtual
> disk allocated within LVM and then build space anew before creating some
> future DomU, or can/should one simply recycle the nominated logical volume?

Just use lvremove to remove the guest's LV, and that space is
automatically given back to the volume group, ready for next time you
run lvcreate.

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