Recently an IBM DB2 expert dropped by to give a colleague and me a short 2 days introduction of this database. I had organized for an unused AMD64 server to be used as a playground. I thought, it would be nice if I could provide each of us with an independent environment. That’s when I thought about Xen. I had enjoyed a brief Xen introduction during the SLES10 boot camp in Nürnberg, therefore I though Xen might be the way to go. I could’ve used VMware Server, but since I intended to install a distributed SAP Netweaver system after out DB2 introduction, I thought the paravirtualisation of Xen might give me a performance benefit.
Anyway the setup of three DomU with SLES10 was a breeze. First the relevant Xen utilities and tools in addition to the kernel packages must be installed. After rebooting I defined three Xen DomU with a nice GUI. Common wisdom on the Net is, that LVM2 slices work better than simple file images. So I sliced the second hard disc of the system into three pieces under control of LVM2. Since I had access to a networked Novell SLES 10 installation server, I considered doing three installs from scratch just as easy as if I would harvest the file tree from some existing installation. Apart from the manual input for the SLES 10 installation process, the whole setup process was graphical. I had three DomUs with SLES10 with only a couple of mouse clicks. The whole process was a very pleasant experience.
After that, I had to shuffle the data within the LVM2 volumes a little bit around, to allow the repartition within of the LVM2 slices. I had SLES 10 installed with 1.5Gb of swap and the rest for the root-fs. However 1.5Gb swap is not enough if you intend to fiddle with SAP Netweaver in a DomU. Configure more than 2Gb, best go directly for 4Gb of swap and of course have enough main memory. This particular system was equipped with 8Gb. I configured 2Gb for each DomU. In the end I really did succeed to install the various SAP instances into the three DomUs in a distributed setup.
During this data shuffling I learned about another important command: kpartx. You need this command, if you want to access the partitions within the logical volume. Consider these outputs:
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
root1 xen -wi-a- 24.84G
root2 xen -wi-a- 24.84G
root3 xen -wi-a- 24.84G
The volume group xen is presenting the whole 80Gb disc. Then there are 3 logical volumes, each about 25Gb in size. Using fdisk on one of these logical volumes displays this output:
# fdisk -l /dev/mapper/xen-root1
Disk /dev/mapper/xen-root1: 26.6 GB, 26675773440 bytes
255 heads, 63 sectors/track, 3243 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/mapper/xen-root1p1 1 312 2506108+ 82 Linux swap / Solaris
/dev/mapper/xen-root1p2 * 313 3243 23543257+ 83 Linux
As you can, the SLES10 installation process created two partitions within the logical volume. Now, how can I access root-fs of this DomU? The devices /dev/mapper/xen-root1p* don’t actually exist.
Here is, where the kpartx command comes into the picture. kpartx belongs to the Multipathing tools. It installs specific mappings and actually creates devices, so that you can mount the partitions within the logical volume. The -l option lists, -a adds and -d deletes the partitions devmappings.
# kpartx -l /dev/mapper/xen-root1
xen-root1p1 : 0 5012217 /dev/mapper/xen-root1 63
xen-root1p2 : 0 47086515 /dev/mapper/xen-root1 5012280
# kpartx -a /dev/mapper/xen-root1
# ls -l /dev/mapper/xen-root1*
brw------- 1 root root 253, 2 Sep 3 10:24 /dev/mapper/xen-root1
brw------- 1 root root 253, 5 Sep 12 15:11 /dev/mapper/xen-root1p1
brw------- 1 root root 253, 6 Sep 12 15:11 /dev/mapper/xen-root1p2
Now you can mount the device /dev/mapper/xen-root1p2 and operate in the root-fs of the corresponding Xen DomU.
After this pleasant experience with Xen and SLES10 I wanted to get my hands a little more dirty, this time on my preferred Gentoo distribution. “May the source be with you.” At the time, when I started my first experiments, the latest Xen version in Portage was still 3.0.4. So I downloaded the 3.1 sources from xensource and compiled the corresponding 2.6.18 Linux kernel and even succeeded in creating a initrd/initramfs from the Xen build tree with the Gentoo genkernel utility. After the appropriate modifications for the Grub bootloader the newly created kernel started to boot, but then I hit a wall. The boot would hang during the load of the aic79xx module in the initrd, the module for the onboard hard disc controller. I tried what I could think off, but I couldn’t get beyond this point. Also studying various How-To’s from the Net didn’t supply any hint, what my problem might be.
Anyway, some time passed with other activities. In the meantime the ebuilds for Xen 3.1 became available in the Portage tree and the xen-sources ebuild for the kernel was even updated to 2.6.20. So I retried with this version. However I hit the same block. The initrd wouldn’t finish to load the aic79xx module. I can only say: RTFM. When I finally read the Xen documentation it hit me right between the eyes. The are a couple of arguments, that also need to be specified for the Xen hypervisor. On my particular system the kernel arguments noapic and pci=noacpi are required to boot a standard Linux kernel. Once I supplied similar arguments to the loading of the Xen hypervisor my problem was solved. I actually used the arguments noapic and acpi=off.
So, the thing to learn here, if you need any special arguments for booting like for instance acpi=off you have to check with the Xen documentation, if the arguments have to be issued to the hypervisor as well.
Out of curiosity, since I had the Xen kernel now running, I tried if I could get my VMware virtual machine to run. That didn’t went down so well. To bad in fact, that the VMware disc of the Windows VM became unusable due to the resulting kernel panic.