This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-users] Questions on qcow, qcow2 versus LVM

Thanks for the reply - interesting that you don't have the same problem as
I do.  Maybe it is an error or ommission in my scripts?  Here are the
commands that are run to provision a domU called 'myvm' with 10GB and
512MB of swap (dom0 is CentOS 5.4 with xen 3.4.1 from the Gitco

# domU backing store
lvcreate -C y -L 10G -n myvm VolGroupVM
parted /dev/VolGroupVM/myvm mklabel msdos
parted /dev/VolGroupVM/myvm mkpartfs primary ext2 0 1024000
kpartx -p "" -av /dev/VolGroupVM/myvm
tune2fs -j /dev/mapper/myvm1
kpartx -d /dev/VolGroupVM/myvm

# domU swap
lvcreate -C y -L 512 -n myvm-swap VolGroupVM
parted /dev/VolGroupVM/myvm-swap mklabel msdos
parted /dev/VolGroupVM/myvm-swap mkpartfs primary linux-swap 0 512
mkswap /dev/mapper/VolGroupVM-myvm--swapp1
lvscan | sort | grep ${NAME}

Then it is basically a case of (from memory):

mount -t ext3 /dev/mapper/myvm1 /mnt/vminstall
tar -xzf /home/vmimages/image.tar.gz -C /mnt/vminstall
umount /mnt/vminstall

And the domu config file looks like this:

#  -*- mode: python; -*-
name = "myvm"
maxmem = 512
memory = 512
vcpus = 1
disk = [ "phy:/dev/VolGroupVM/myvm,xvda,w",
"phy:/dev/VolGroupVM/myvm-swap,xvdb,w" ]
vif = [ "mac=ae:00:59:15:1a:0b,ip=,vifname=vifmyvm0" ]
kernel = "/usr/lib/xen/boot/pv-grub-x86_32.gz"
extra = "(hd0,0)/boot/grub/menu.lst"
on_poweroff = "destroy"
on_reboot   = "restart"
on_crash    = "restart"

I have cobbled together these commands based on what I have read at
various places.  Have I screwed up somewhere?

Many thanks,


On Thu, December 24, 2009 2:24 pm, Fajar A. Nugraha wrote:
> On Thu, Dec 24, 2009 at 9:04 PM, Matthew Law <matt@xxxxxxxxxxxxxxxxxx>
> wrote:
>> I do care about space saving but would trade a little for flexibility
>> and
>> performance.
> Good to hear that. So at least we can rule out LVM snapshot problems.
> At least for now.
>>  The dom0 in question has 8 disks on an Adaptec 5805Z
>> controller split into a 2 disk RAID1 volume for the OS and a 6 disk
>> RAID6
>> volume for domU storage and vm images.  I don't want to use individual
>> disks or create scads of partitions for each domU.
> I use LVM for domU disks as well. Never had the problem you mentioned.
>> I have a bunch of shell scripts to
>> provision domUs by creating an LV, formatting it, mounting it and
>> untarring the template image into it.
> That's basically what I do. I use RHEL 5.4, some with builtin Xen,
> others with Gitco's Xen rpm.
> You mentioned about disklabels and partitions. Does that mean you use
> kpartx? Did you remember to delete the mappings later using "kpartx
> -d"?
> I seriously suspect your problem is related to kpartx. Try changing
> your setup a little bit so that it maps LVs as partition instead of
> disks. Something like this on your domU config file:
> disk =        [
>       'phy:/dev/vg/rootlv,xvda1,w',
>       'phy:/dev/vg/swaplv,xvda2,w',
>       ]
> you could use s/hda1 instead of xvda1, if your existing domU already
> use that. There shouldn't be any change necessary to your domU tar
> image (including fstab or initramfs) if you don't use LVM on domU side
> as well.
> After a successful series of lvcreate - mkfs - mount - untar - unmount
> - xm create - xm destroy - lvremove, that should at least narrow down
> your problem.

Xen-users mailing list