I do pretty much what you are describing with LVM. I create LVs named
vm_whatever_root and vm_whatever_swap (more if I need them), then
present each one to my domains as xvda, xvdb, and so on and mount those
block devices directly, no partition table.
In my experience all the installers for the various Linux distros don't
know how to handle this.
What I did to get through this was to first install onto an external USB
drive first (any additional storage outside of LVM will work). After
that base install was complete I mounted the root fs from the dom0 on my
xen host and made a tarball of the whole fs (including directories like
/proc and /dev BUT excluding their contents):
tar -c -z -v -f /vm.tar.gz --exclude='/cdrom' --exclude='/initrd.img'
--exclude='/media/*' --exclude='/selinux/*' --exclude='/sys/*'
--exclude='/tmp/*' --exclude='/vmlinuz.old' --exclude='/boot/*'
--exclude='/dev/*' --exclude='/initrd.img.old' --exclude='/lost+found'
--exclude='/mnt/*' --exclude='/proc/*' --exclude='/srv/*'
--exclude='/vmlinuz' --exclude='/nearcore.tar.gz' /*
(For HVM deploys, you will not want to exclude the contents of /boot or
the root link to vmlinuz)
Now on the dom0 I create the LVs that I want for a new VM, create
filesystems on them, mount them on the dom0, and untar this tarball into
them. While the filesystem is still mounted I make the necessary
changes for fstab, networking, hvc0 console, and so on.
The nice part is once you do the xen specific modification you can
re-tar up the filesystem and have an almost ready to go install for your
For fstab you mount just the xvd* block devices, no partition numbers.
Here is my domain config and fstab for a VM I created this way:
proc /proc proc defaults 0 0
/dev/xvda / ext3 noatime,errors=remount-ro 0 1
/dev/xvdb none swap sw 0 0
/dev/xvdc /data jfs defaults 0 0
vast:~# cat /etc/xen/vm_store.cfg
name = 'store'
kernel = '/vm/vmboot/u904_64/vmlinuz-2.6.28-11-server'
ramdisk = '/vm/vmboot/u904_64/initrd.img-2.6.28-11-server'
root = '/dev/xvda ro'
vcpus = 1
memory = 1024
disk = [ 'phy:/dev/sysvg/vm_store_root,xvda,w',
vif = [ 'bridge=br0,mac=00:16:3e:00:00:01' ]
on_shutdown = 'destroy'
on_reboot = 'restart'
on_crash = 'rename-restart'
There are big advantages to the way you want to handle storage as
logical volumes in the dom0. In addition to being able to resize the
storage under the VMs devices, one thing I have found really useful is
using snapshots to centralize backups on the host rather than backing up
each client. You can make an LVM snapshot of an LV that is presented to
a domU on the dom0, then mount it and do whatever you want with it.
Hope this helps!
I was wondering if there's a way to force a certain partitioning
schema when using LVM.
Let me explain: I would like to create two LVM volumes in the dom0,
format one as ext3 and the other one as a swap partition. Then I'd
like to install CentOS using the first one as the root partition and
the second one as the swap partition. The problem is the installer
wants to repartition both volumes. It says: "/dev/hda1 currently has a
loop partition layout"
Is there a way to create and format those volumes in a way that will
be usable by the installer.
If not, how can I mount and expand/shrink such volumes in the dom0?
Thanks a lot for your help! :)
Xen-users mailing list
Xen-users mailing list