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] hvm questions (hvm vs. patched DomU kernel)

To: Christian Anton <mail@xxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-users] hvm questions (hvm vs. patched DomU kernel)
From: Steve Dobbelstein <steved@xxxxxxxxxx>
Date: Tue, 5 Sep 2006 12:14:33 -0500
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 05 Sep 2006 10:15:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060904173505.GA11484@xxxxxxxxxxxxxxxxxxxx>
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>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Christian Anton <mail@xxxxxxxxxxxxxxxxx> wrote on 09/04/2006 12:35:06 PM:

Mats Petersson answered many of these questions.  (Thanks, Mats.)  I'll
handle a couple.

> 2. Handling of unmodified guests
> I enjoyed the handling of patched guest os's a much, because the xm
> console (the virtual serial console) gave me much comfort setting up
> networking and services in a DomU.
> Is it possible to use this on unmodified guests too? Do i have to
> configure a serial port in the virtual machine and do some configuration
> to create a virtual serial port to connect to with xm console / minicom?
> Is this documented anywhere?

I have been successfully using a serial console to my HVM guests for a
while.  However, I have only been using a serial console (no graphics)
since the majority of my testing is scripted.  To setup your HVM domain for
serial access, edit the domain configuration file and set sdl=0, vnc=0, and
nographic=1.  In the HVM domain, you may also need to edit /etc/inittab to
launch a getty for the console (e.g., co:2345:respawn:/sbin/agetty ttyS0
115200 vt100-nav) and edit /etc/securetty to allow login from the serial
port (e.g., ttyS0).

> 3. Disks (LVM, Files...)
> I use LVM logical volumes for my DomUs with patched kernels passing them
> to the domUs as partitions, such as hda1, hda2... The big advantage of
> this is that i can copy a virtual machine with rsync, then configure the
> nessecary things using a chroot, leave and power up the machine. Great!
> Doing backups using LVM snapshots would be something cool, too. Using
> the hvmloader it seems that this is not possible at all, i can only pass
> LVM volumes or files as entire disk (hda, hdb) and the guest operating
> system must partition it. So i am not able to access the files on the
> virtual disk when the machine is not running, right? Is there any chance
> to use a similar setup as i use for modified guests?

I use LVM volumes for my HVM disks, too.  To access one of the file systems
in the disk image, I create a loop device that maps to the partition on the
disk image and then mount the loop device.  For example,  to access the
first partition on the disk image I do:
losetup -o 32256 /dev/loop1 /dev/virt-blkdev-backend/hvm1
mount /dev/loop1 /mnt/hvm1

If you have other partitions in the disk image, you can calculate their
offsets. First, run fdisk on the LVM volume and display the partition
information.  For example:
dib:~ # fdisk /dev/virt-blkdev-backend/hvm1

The number of cylinders for this disk is set to 2088.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/virt-blkdev-backend/hvm1-save: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

                             Device Boot      Start         End      Blocks
Id  System
/dev/virt-blkdev-backend/hvm1p1       *           1          66
530113+  83  Linux
/dev/virt-blkdev-backend/hvm1p2                  67         328     2104515
82  Linux swap / Solaris
/dev/virt-blkdev-backend/hvm1p3                 329         851
4200997+  83  Linux
/dev/virt-blkdev-backend/hvm1p4                 852        2088
9936202+  83  Linux

The offset for the third partition will be the starting cylinder, 328 (329
- 1, since cylinder start numbers are 1-based, not 0-based), * 8225280
(bytes per cylinder) = 2697891840.

To mount the second partition:
losetup -o 2697891840 /dev/loop1
mount /dev/loop1 /mnt/hvm1

Hope this helps.

Steve D.

Xen-users mailing list

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