WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Prevent partitioning on LVM

To: Michele <ftf@xxxxxxxxxxxx>
Subject: Re: [Xen-users] Prevent partitioning on LVM
From: "Thaddeus J. Hogan" <thaddeus@xxxxxxxxxx>
Date: Wed, 05 Aug 2009 09:22:31 -0500
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 05 Aug 2009 07:23:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <2ff7902b0908050641s47011ab2x41452f9004fa2683@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <2ff7902b0908050641s47011ab2x41452f9004fa2683@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)
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 choice distribution.

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:

Fstab:
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

Xen Config:
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',
       'phy:/dev/sysvg/vm_store_swap,xvdb,w',
       'phy:/dev/datavg/datalv,xvdc,w',
       'phy:/dev/sysvg/bananaw7lv,xvde,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!

-- Thaddeus

Michele wrote:
Hi,

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! :)

- Michele

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>