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] Guest O/S Questions

To: xen-users <xen-users@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-users] Guest O/S Questions
From: "Karsten M. Self" <karsten@xxxxxxxxxxxxx>
Date: Mon, 29 Aug 2005 15:08:52 -0700
Delivery-date: Mon, 29 Aug 2005 22:06:57 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <430CED91.4050204@xxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <20050824T144313Z_87A6000D0001@xxxxxxxxx> <200508242237.08951.mark.williamson@xxxxxxxxxxxx> <430CED91.4050204@xxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Debian Thunderbird 1.0.2 (X11/20050331)
Anthony Liguori wrote:

Mark Williamson wrote:

I have just recently discovered the XEN VMM and am trying to familiarize
myself with it.  I'm a newbe at it, so bear with me.


No probs, here goes...

I'd like to install an O/S onto a guest virtual machine. Domain 0 is RHEL4 on Xen 2.0.7. My question is how I would go about installing from a set of distribution CD's (say RHEL4 or SUSE9) into a file-backed VMM. Can anyone
help me out with this?


Installing into a file-backed VBD from a distro CD is tricky.

Actually, if you use QEMU to install the distro into a raw disk, and you only create one partition on the disk, you should be able to just use a command like this:

That's actually getting to be a preferred method here, at least for some folks.

qemu file-backed installs allow you to use an existing RHEL installer, without much fuss or mess, the tricky bit is finding the filesystem afterward, as what qemu produces is a _partitioned_ file with filesystems within it.


dd skip=63 bs=512 if=qemu.img of=xen.img

Keep in mind, I've not tried this myself :-)

Exporting the qemu image as /dev/hda in domU and just setting your parameters right seems to work well and is much simplier.

Are you doing this with the qemu partitioned file itself?

The procedure I've worked up is:


1. Create a target install file.  Creating this as a sparse file saves
   blocks on disk until you actually need them:

       dd if=/dev/zero of=rhel4_qemu bs=1024k seek=$(( 6 * 1024 )) count=0

   The $(( 6 * 1024 )) gives you 6 GB to work with, the seek means it's
   sparse, and the count=0 means there's only one block used on disk

2. Install RHEL flavor of your choosing.  You can boot either from an
   install CD, _or_ an ISO image corresponding to same:

       qemu -cdrom <cd drive or ISO image> -boot c rhel4_qemu

   Walk through the installation.  Your image file (rhel4_qemu) will
   automatically be partitioned.

3. Shut down qemu after the install is completed.

4. Find out the image file's partitioning.  fdisk's '-u' option gives
   output in sectors.  This helps in the next step.  Sample partition
   table:
       $ /sbin/fdisk -lu rhel4
       You must set cylinders.
       You can do this from the extra functions menu.

       Disk rhel4: 0 MB, 0 bytes
       255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
       Units = sectors of 1 * 512 = 512 bytes

        Device Boot      Start         End      Blocks   Id  System
       rhel4p1   *          63      208844      104391   83  Linux
rhel4p2 208845 401624 96390 82 Linux swap / Solaris
       rhel4p3          401625     4192964     1895670   83  Linux

   Ignore the cylinder messages (they matter if you're going to modify
   the partition table).

   The start sector times the blocksize (512 bytes) gives you the
   partition offset in bytes.  This is used if you want to loopback
   mount the filesystems to copy them someplace else, which you do.

   The first partition is /boot, the second is /.  I didn't use logical
   volumes, though it's possible to do so, complicating matters
   somewhat more.

5. Loopback mount the qemu images, creating a couple of mountpoints.
   Using the file I'm referencing above (rhel4):

       mkdir mp1 mp2
       su -c 'mount -o loop,offset=$(( 63 * 512 )) -t ext3 rhel4 mp1'
       su -c 'mount -o loop,offset=$(( 4192964 * 512 )) -t ext3 rhel4 mp2'

As a final step, you could copy the contents of these two mountpoints
into a partition or a single filesystem image (a file with just a
filesystem in it, no partitions) which can be used for a Xen file-backed
DomU, etc.

You will have to modify the DomU's /etc/fstab and likely comment the MAC
address registered in /etc/sysconfig/network-scripts/ifcfg-eth0 for
things to work properly.

Once you have a suitable image, you can simply use it as a DomU image for new deployments.


There are some good related docs on Fedora and Debian installs as well:

https://www.redhat.com/archives/fedora-devel-list/2005-January/msg01320.html
http://www.fedoraproject.org/wiki/FedoraXenQuickstart

Debian:  http://hands.com/d-i/HOWTO-xen.txt


--
Karsten M. Self <karsten@xxxxxxxxxxxxx>
XenSource, Inc.
2300 Geng Road #250                                +1 650.798.5900 x259
Palo Alto, CA 94303                                +1 650.493.1579 fax


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