[CentOS] building a Xen guest image on straight LVM partitions?

Amos Shapira amos.shapira at gmail.com
Tue Dec 11 06:44:20 UTC 2007


On 11/12/2007, Johnny Tan <linuxweb at gmail.com> wrote:
> Amos Shapira wrote:
> > When I needed to build Xen guests under Debian I could follow more or
> > less the instructions in http://preview.tinyurl.com/2oc48r and the
> > advantage of this approach is that it allows me to setup the Xen guest
> > directly on the LVM partition without making it consider the LVM
> > partition as an entire disk with a partition table.
>
> I might be missing something, but that link seems to talk
> about FAI and doesn't mention xen. I'm interested in seeing
> how it can install on the LVM partition but the OS doesn't
> see it as an entire disk with a partition table. What does
> "fdisk -l" show, then?

The anchor I pointed to is about instructions for creating an entire
CentOS file system hierarchy using Yum on Debian without having to go
through the CentOS boot process.
Nothing to do with FAI except that I found the instructions extremely
useful for my needs.

So what I used to do on Debian Dom0 in order to build a new CentOS 5 DomU was:
1. Create an LV for the filesystem, "mke2fs -j
/dev/xen/created-lv-name", "mount ..."
2. Go through those instructions to setup the filesystem hierarchy.
3. "umount /dev/xen/created-lv-name", create another LV for the swap
4. Manually configure the /etc/xen/*.cfg file to use the new LV's and
map them into disks in the guest machine:

disk = [ 'phy:/dev/xen/centos5.0-01-root,ioemu:sda1,w',
            'phy:/dev/xen/centos5.0-01-swap,ioemu:sda2,w']
device_model='/usr/lib/xen-3.0.3-1/bin/qemu-dm'

5. boot the image as a Xen guest.

As for the fdisk output - it looks for partition tables on each of the
mapped LV's but doesn't find them:

# fdisk -l

Disk /dev/sda1: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sda1 doesn't contain a valid partition table

Disk /dev/sda2: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sda2 doesn't contain a valid partition table

I suspect that maybe I could follow the same procedure under CentOS
but under the current deadline pressure I'm looking for the fastest
route.

Cheers,

--Amos



More information about the CentOS mailing list