Xen 3.2 on CentOS 5.2 x86_64 / RHEL 5.2 x86_64

Since my drivers are not signed, you will need to temporarily disable signature checking for yum.

# vi /etc/yum.conf
Make sure it says gpgcheck=0

Download the file and untar it.

# tar xvzf xen-3.2.0-CentOS5.2.tar.gz
xen-3.2.0-CentOS5.2/
xen-3.2.0-CentOS5.2/xen-3.2.0-0xs.x86_64.rpm
xen-3.2.0-CentOS5.2/xen-libs-3.2.0-0xs.x86_64.rpm
xen-3.2.0-CentOS5.2/xen-devel-3.2.0-0xs.x86_64.rpm

# cd xen-3.2.0-CentOS5.2

Install the RPMs.

#yum install -y xen-3.2.0-0xs.x86_64.rpm xen-libs-3.2.0-0xs.x86_64.rpm xen-devel-3.2.0-0xs.x86_64.rpm

It will download a bunch of dependencies and install them. Among them will be a new kernel - kernel-xen.

# vi /etc/yum.conf
Set gpgcheck back to the old value: gpgcheck=1 if it was originally 1.

The only problem at this point is that yum for some reason doesn't update the boot entry, so we have to do this manually.

# vi /boot/grub/menu.lst

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.1.6.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-92.1.6.el5
module /vmlinuz-2.6.18-92.1.6.el5xen ro root=/dev/VolGroup00/LogVol00
module /initrd-2.6.18-92.1.6.el5xen.img
title CentOS (2.6.18-92.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-92.el5.img

We want to update the CentOS (2.6.18-53.1.21.el5xen) entry, and set it to use the proper kernel - xen.gz-3.2

This is what my updated menu.lst looks like - yours may differ. I have also set the default to 0, so that it boots my xen kernel automatically.

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.1.6.el5xen)
root (hd0,0)
kernel /xen.gz-3.2
module /vmlinuz-2.6.18-92.1.6.el5xen ro root=/dev/VolGroup00/LogVol00
module /initrd-2.6.18-92.1.6.el5xen.img
title CentOS (2.6.18-92.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-92.el5.img

Once you reboot you should automatically boot into the xen kernel and be able to create virtual machines.

3ware 9690SA on CentOS 5.2 x86_64 with Xen

Apparently 9690SA support still didn't arrive in CentOS 5.2, so you still need some tricks to get it to work.

First download the driver disk from 3ware. If you are using a Xen kernel, you will need to get it from this knowledgebase article: http://www.3ware.com/KB/article.aspx?id=15399.

Extract the files and put them on a floppy. When installing linux you will need to type in 'linux dd' in the prompt when you boot off the CentOS 5.2 DVD/CD.

After installation, everything appears to be fine, but once you run yum update, and it updates the kernel, you will be unable to boot into the new kernel. We will need to do a few steps before it will work with a new kernel.

First, download the driver disk to your CentOS 5.2 box. (I couldn't get the URL off the page, so I FTPed the file over).

unzip the file:

# unzip 208-3w-95xx-9650_9690_rhel5u2-kernel2.6.18-92.el5-installdisk-x86_64-9.5-GUID28bef5f421164b46ab5d859e5d957eea.zip
Archive: 208-3w-95xx-9650_9690_rhel5u2-kernel2.6.18-92.el5-installdisk-x86_64-9.5-GUID28bef5f421164b46ab5d859e5d957eea.zip
inflating: modinfo
inflating: modules.alias
inflating: modules.cgz
inflating: modules.dep
inflating: modules.pcimap
inflating: pci.ids
inflating: pcitable
inflating: Readme
inflating: rhdd

Now we need to get the kernel modules out of modules.cgz.

# zcat modules.cgz | cpio -ivd
2.6.18-92.el5
2.6.18-92.el5/x86_64
2.6.18-92.el5/x86_64/3w-9xxx.ko
2.6.18-92.el5xen
2.6.18-92.el5xen/x86_64
2.6.18-92.el5xen/x86_64/3w-9xxx.ko
1421 blocks

Since we are updating a regular kernel - not xen, we will use the 2.6.18-92.el5/x86_64/3w-9xxx.ko file.

# cp 2.6.18-92.el5/x86_64/3w-9xxx.ko /lib/modules/2.6.18-92.1.6.el5/updates/

Now we need to make a new initrd

# depmod 2.6.18-92.1.6.el5
# cp /boot/initrd-2.6.18-92.1.6.el5.img /boot/initrd-2.6.18-92.1.6.el5.img.old
# mkinitrd -v -f /boot/initrd-2.6.18-92.1.6.el5.img 2.6.18-92.1.6.el5
Creating initramfs
Looking for deps of module ehci-hcd
Looking for deps of module ohci-hcd
Looking for deps of module uhci-hcd
Looking for deps of module ext3: jbd
Looking for deps of module jbd
Looking for driver for device sda2
Looking for deps of module pci:v000013C1d00001005sv000013C1sd00001005bc01sc04i00: scsi_mod 3w-9xxx
Looking for deps of module scsi_mod
Looking for deps of module sd_mod: scsi_mod
Looking for deps of module 3w-9xxx: scsi_mod
Looking for deps of module ahci: scsi_mod libata
Looking for deps of module libata: scsi_mod
Looking for deps of module usb-storage: scsi_mod
Looking for deps of module ide-disk
Looking for deps of module dm-mod
Looking for deps of module dm-mirror: dm-mod
Looking for deps of module dm-zero: dm-mod
Looking for deps of module dm-snapshot: dm-mod
Using modules: /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/host/ohci-hcd.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.18-92.1.6.el5/kernel/fs/jbd/jbd.ko /lib/modules/2.6.18-92.1.6.el5/kernel/fs/ext3/ext3.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/scsi/scsi_mod.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/scsi/sd_mod.ko /lib/modules/2.6.18-92.1.6.el5/updates/3w-9xxx.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/ata/libata.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/ata/ahci.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/storage/usb-storage.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-mod.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-mirror.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-zero.ko /lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-snapshot.ko
/sbin/nash -> /tmp/initrd.RX6099/bin/nash
/sbin/insmod.static -> /tmp/initrd.RX6099/bin/insmod
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/host/ehci-hcd.ko' -> `/tmp/initrd.RX6099/lib/ehci-hcd.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/host/ohci-hcd.ko' -> `/tmp/initrd.RX6099/lib/ohci-hcd.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/host/uhci-hcd.ko' -> `/tmp/initrd.RX6099/lib/uhci-hcd.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/fs/jbd/jbd.ko' -> `/tmp/initrd.RX6099/lib/jbd.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/fs/ext3/ext3.ko' -> `/tmp/initrd.RX6099/lib/ext3.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/scsi/scsi_mod.ko' -> `/tmp/initrd.RX6099/lib/scsi_mod.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/scsi/sd_mod.ko' -> `/tmp/initrd.RX6099/lib/sd_mod.ko'
`/lib/modules/2.6.18-92.1.6.el5/updates/3w-9xxx.ko' -> `/tmp/initrd.RX6099/lib/3w-9xxx.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/ata/libata.ko' -> `/tmp/initrd.RX6099/lib/libata.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/ata/ahci.ko' -> `/tmp/initrd.RX6099/lib/ahci.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/usb/storage/usb-storage.ko' -> `/tmp/initrd.RX6099/lib/usb-storage.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-mod.ko' -> `/tmp/initrd.RX6099/lib/dm-mod.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-mirror.ko' -> `/tmp/initrd.RX6099/lib/dm-mirror.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-zero.ko' -> `/tmp/initrd.RX6099/lib/dm-zero.ko'
`/lib/modules/2.6.18-92.1.6.el5/kernel/drivers/md/dm-snapshot.ko' -> `/tmp/initrd.RX6099/lib/dm-snapshot.ko'
/sbin/lvm.static -> /tmp/initrd.RX6099/bin/lvm
/etc/lvm -> /tmp/initrd.RX6099/etc/lvm
`/etc/lvm/lvm.conf' -> `/tmp/initrd.RX6099/etc/lvm/lvm.conf'
/sbin/dmraid.static -> /tmp/initrd.RX6099/bin/dmraid
/sbin/kpartx.static -> /tmp/initrd.RX6099/bin/kpartx
Adding module ehci-hcd
Adding module ohci-hcd
Adding module uhci-hcd
Adding module jbd
Adding module ext3
Adding module scsi_mod
Adding module sd_mod
Adding module 3w-9xxx
Adding module libata
Adding module ahci
Adding module usb-storage
Adding module dm-mod
Adding module dm-mirror
Adding module dm-zero
Adding module dm-snapshot

As you can see, it used our version of the 3w-9xxx.ko instead of the one that came with the kernel.

Now we reboot and see that it books successfully into the new kernel.

# shutdown -r now

Now lets say that we have a xen kernel. Either by installing the stock xen or using the 3.2 version from my companion entry, now we need to update the 3w-9xxx.ko for that kernel as well, otherwise it won't boot. The steps are pretty similar, substituting the proper kernel version, we get:

# cp 2.6.18-92.el5xen/x86_64/3w-9xxx.ko /lib/modules/2.6.18-92.1.6.el5xen/updates/

Now we need to make a new initrd

# depmod 2.6.18-92.1.6.el5xen
# cp /boot/initrd-2.6.18-92.1.6.el5xen.img /boot/initrd-2.6.18-92.1.6.el5xen.img.old
# mkinitrd -v -f /boot/initrd-2.6.18-92.1.6.el5xen.img 2.6.18-92.1.6.el5xen
Creating initramfs
Looking for deps of module ehci-hcd
Looking for deps of module ohci-hcd
Looking for deps of module uhci-hcd
Looking for deps of module ext3: jbd
Looking for deps of module jbd
Looking for driver for device sda2
Looking for deps of module pci:v000013C1d00001005sv000013C1sd00001005bc01sc04i00: scsi_mod 3w-9xxx
Looking for deps of module scsi_mod
Looking for deps of module sd_mod: scsi_mod
Looking for deps of module 3w-9xxx: scsi_mod
Looking for deps of module ahci: scsi_mod libata
Looking for deps of module libata: scsi_mod
Looking for deps of module usb-storage: scsi_mod
Looking for deps of module ide-disk
Looking for deps of module dm-mod
Looking for deps of module dm-mirror: dm-mod
Looking for deps of module dm-zero: dm-mod
Looking for deps of module dm-snapshot: dm-mod
Using modules: /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/host/ohci-hcd.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/fs/jbd/jbd.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/fs/ext3/ext3.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/scsi/scsi_mod.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/scsi/sd_mod.ko /lib/modules/2.6.18-92.1.6.el5xen/updates/3w-9xxx.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/ata/libata.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/ata/ahci.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/storage/usb-storage.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-mod.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-mirror.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-zero.ko /lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-snapshot.ko
/sbin/nash -> /tmp/initrd.sW6636/bin/nash
/sbin/insmod.static -> /tmp/initrd.sW6636/bin/insmod
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/host/ehci-hcd.ko' -> `/tmp/initrd.sW6636/lib/ehci-hcd.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/host/ohci-hcd.ko' -> `/tmp/initrd.sW6636/lib/ohci-hcd.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/host/uhci-hcd.ko' -> `/tmp/initrd.sW6636/lib/uhci-hcd.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/fs/jbd/jbd.ko' -> `/tmp/initrd.sW6636/lib/jbd.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/fs/ext3/ext3.ko' -> `/tmp/initrd.sW6636/lib/ext3.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/scsi/scsi_mod.ko' -> `/tmp/initrd.sW6636/lib/scsi_mod.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/scsi/sd_mod.ko' -> `/tmp/initrd.sW6636/lib/sd_mod.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/updates/3w-9xxx.ko' -> `/tmp/initrd.sW6636/lib/3w-9xxx.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/ata/libata.ko' -> `/tmp/initrd.sW6636/lib/libata.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/ata/ahci.ko' -> `/tmp/initrd.sW6636/lib/ahci.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/usb/storage/usb-storage.ko' -> `/tmp/initrd.sW6636/lib/usb-storage.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-mod.ko' -> `/tmp/initrd.sW6636/lib/dm-mod.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-mirror.ko' -> `/tmp/initrd.sW6636/lib/dm-mirror.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-zero.ko' -> `/tmp/initrd.sW6636/lib/dm-zero.ko'
`/lib/modules/2.6.18-92.1.6.el5xen/kernel/drivers/md/dm-snapshot.ko' -> `/tmp/initrd.sW6636/lib/dm-snapshot.ko'
/sbin/lvm.static -> /tmp/initrd.sW6636/bin/lvm
/etc/lvm -> /tmp/initrd.sW6636/etc/lvm
`/etc/lvm/lvm.conf' -> `/tmp/initrd.sW6636/etc/lvm/lvm.conf'
/sbin/dmraid.static -> /tmp/initrd.sW6636/bin/dmraid
/sbin/kpartx.static -> /tmp/initrd.sW6636/bin/kpartx
Adding module ehci-hcd
Adding module ohci-hcd
Adding module uhci-hcd
Adding module jbd
Adding module ext3
Adding module scsi_mod
Adding module sd_mod
Adding module 3w-9xxx
Adding module libata
Adding module ahci
Adding module usb-storage
Adding module dm-mod
Adding module dm-mirror
Adding module dm-zero
Adding module dm-snapshot

Now we reboot, and it should boot sucessfully into xen.

3ware 9690SA on CentOS 5.1 x86_64 with Xen

9690SA Support doesn't come with the distribution until CentOS 5.2, so for 5.1 you will need some tricks to get it to work.

First download the driver disk from 3ware. If you are using a Xen kernel, you will need to get it from this knowledgebase article: http://www.3ware.com/KB/article.aspx?id=15257.

Extract the files and put them on a floppy. When installing linux you will need to type in 'linux dd' in the prompt when you boot off the CentOS 5.1 DVD/CD.

After installation, everything appears to be fine, but once you run yum update, and it updates the kernel, you will be unable to boot into the new kernel. We will need to do a few steps before it will work with a new kernel.

First, download the driver disk to your CentOS 5.1 box. (I couldn't get the URL off the page, so I FTPed the file over).

unzip the file:

# unzip 191-3w-95xx-9650_9690_rhel5-kernel2.6.18-53.EL5-installdisk-x86_64-9.5-GUID083205f49ac341bc980c5c58ff4f1bc0.zip
Archive: 191-3w-95xx-9650_9690_rhel5-kernel2.6.18-53.EL5-installdisk-x86_64-9.5-GUID083205f49ac341bc980c5c58ff4f1bc0.zip
inflating: modinfo
inflating: modules.alias
inflating: modules.cgz
inflating: modules.dep
inflating: modules.pcimap
inflating: pci.ids
inflating: pcitable
inflating: Readme
inflating: rhdd

Now we need to get the kernel modules out of modules.cgz.

# zcat modules.cgz | cpio -ivd
2.6.18-53.el5
2.6.18-53.el5/x86_64
2.6.18-53.el5/x86_64/3w-9xxx.ko
2.6.18-53.el5xen
2.6.18-53.el5xen/x86_64
2.6.18-53.el5xen/x86_64/3w-9xxx.ko
1419 blocks

Since we are updating a regular kernel - not xen, we will use the 2.6.18-53.el5/x86_64/3w-9xxx.ko file.

# cp 2.6.18-53.el5/x86_64/3w-9xxx.ko /lib/modules/2.6.18-53.1.21.el5/updates/

Now we need to make a new initrd

# depmod 2.6.18-53.1.21.el5
# cp /boot/initrd-2.6.18-53.1.21.el5.img /boot/initrd-2.6.18-53.1.21.el5.img.old
# # mkinitrd -v -f /boot/initrd-2.6.18-53.1.21.el5.img 2.6.18-53.1.21.el5
Creating initramfs
Looking for deps of module uhci-hcd
Looking for deps of module ohci-hcd
Looking for deps of module ehci-hcd
Looking for deps of module ext3: jbd
Looking for deps of module jbd
Looking for driver for device sda2
Looking for deps of module pci:v000013C1d00001005sv000013C1sd00001005bc01sc04i00: scsi_mod 3w-9xxx
Looking for deps of module scsi_mod
Looking for deps of module sd_mod: scsi_mod
Looking for deps of module 3w-9xxx: scsi_mod
Looking for deps of module ahci: scsi_mod libata
Looking for deps of module libata: scsi_mod
Looking for deps of module usb-storage: scsi_mod
Looking for deps of module ide-disk
Looking for deps of module dm-mod
Looking for deps of module dm-mirror: dm-mod
Looking for deps of module dm-zero: dm-mod
Looking for deps of module dm-snapshot: dm-mod
Using modules: /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/host/ohci-hcd.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.18-53.1.21.el5/kernel/fs/jbd/jbd.ko /lib/modules/2.6.18-53.1.21.el5/kernel/fs/ext3/ext3.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/scsi/scsi_mod.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/scsi/sd_mod.ko /lib/modules/2.6.18-53.1.21.el5/updates/3w-9xxx.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/ata/libata.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/ata/ahci.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/storage/usb-storage.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-mod.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-mirror.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-zero.ko /lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-snapshot.ko
/sbin/nash -> /tmp/initrd.fI5163/bin/nash
/sbin/insmod.static -> /tmp/initrd.fI5163/bin/insmod
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/host/uhci-hcd.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/uhci-hcd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/host/ohci-hcd.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/ohci-hcd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/host/ehci-hcd.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/ehci-hcd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/fs/jbd/jbd.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/jbd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/fs/ext3/ext3.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/ext3.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/scsi/scsi_mod.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/scsi_mod.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/scsi/sd_mod.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/sd_mod.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/updates/3w-9xxx.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/3w-9xxx.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/ata/libata.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/libata.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/ata/ahci.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/ahci.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/usb/storage/usb-storage.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/usb-storage.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-mod.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/dm-mod.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-mirror.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/dm-mirror.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-zero.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/dm-zero.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5/kernel/drivers/md/dm-snapshot.ko' [elf64-x86-64] to `/tmp/initrd.fI5163/lib/dm-snapshot.ko' [elf64-x86-64]
/sbin/lvm.static -> /tmp/initrd.fI5163/bin/lvm
/etc/lvm -> /tmp/initrd.fI5163/etc/lvm
`/etc/lvm/lvm.conf' -> `/tmp/initrd.fI5163/etc/lvm/lvm.conf'
/sbin/dmraid.static -> /tmp/initrd.fI5163/bin/dmraid
/sbin/kpartx.static -> /tmp/initrd.fI5163/bin/kpartx
Adding module uhci-hcd
Adding module ohci-hcd
Adding module ehci-hcd
Adding module jbd
Adding module ext3
Adding module scsi_mod
Adding module sd_mod
Adding module 3w-9xxx
Adding module libata
Adding module ahci
Adding module usb-storage
Adding module dm-mod
Adding module dm-mirror
Adding module dm-zero
Adding module dm-snapshot

As you can see, it used our version of the 3w-9xxx.ko instead of the one that came with the kernel.

Now we reboot and see that it books successfully into the new kernel.

# shutdown -r now

Now lets say that we have a xen kernel. Either by installing the stock xen or using the 3.2 version from my companion entry, now we need to update the 3w-9xxx.ko for that kernel as well, otherwise it won't boot. The steps are pretty similar, substituting the proper kernel version, we get:

# cp 2.6.18-53.el5xen/x86_64/3w-9xxx.ko /lib/modules/2.6.18-53.1.21.el5xen/updates/

Now we need to make a new initrd

# depmod 2.6.18-53.1.21.el5xen
# cp /boot/initrd-2.6.18-53.1.21.el5xen.img /boot/initrd-2.6.18-53.1.21.el5xen.img.old
# mkinitrd -v -f /boot/initrd-2.6.18-53.1.21.el5xen.img 2.6.18-53.1.21.el5xen
Creating initramfs
Looking for deps of module uhci-hcd
Looking for deps of module ohci-hcd
Looking for deps of module ehci-hcd
Looking for deps of module ext3: jbd
Looking for deps of module jbd
Looking for driver for device sda2
Looking for deps of module pci:v000013C1d00001005sv000013C1sd00001005bc01sc04i00: scsi_mod 3w-9xxx
Looking for deps of module scsi_mod
Looking for deps of module sd_mod: scsi_mod
Looking for deps of module 3w-9xxx: scsi_mod
Looking for deps of module ahci: scsi_mod libata
Looking for deps of module libata: scsi_mod
Looking for deps of module usb-storage: scsi_mod
Looking for deps of module ide-disk
Looking for deps of module dm-mod
Looking for deps of module dm-mirror: dm-mod
Looking for deps of module dm-zero: dm-mod
Looking for deps of module dm-snapshot: dm-mod
Using modules: /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/host/ohci-hcd.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/fs/jbd/jbd.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/fs/ext3/ext3.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/scsi/scsi_mod.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/scsi/sd_mod.ko /lib/modules/2.6.18-53.1.21.el5xen/updates/3w-9xxx.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/ata/libata.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/ata/ahci.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/storage/usb-storage.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-mod.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-mirror.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-zero.ko /lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-snapshot.ko
/sbin/nash -> /tmp/initrd.Js4624/bin/nash
/sbin/insmod.static -> /tmp/initrd.Js4624/bin/insmod
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/host/uhci-hcd.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/uhci-hcd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/host/ohci-hcd.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/ohci-hcd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/host/ehci-hcd.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/ehci-hcd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/fs/jbd/jbd.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/jbd.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/fs/ext3/ext3.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/ext3.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/scsi/scsi_mod.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/scsi_mod.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/scsi/sd_mod.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/sd_mod.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/updates/3w-9xxx.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/3w-9xxx.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/ata/libata.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/libata.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/ata/ahci.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/ahci.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/usb/storage/usb-storage.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/usb-storage.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-mod.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/dm-mod.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-mirror.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/dm-mirror.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-zero.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/dm-zero.ko' [elf64-x86-64]
copy from `/lib/modules/2.6.18-53.1.21.el5xen/kernel/drivers/md/dm-snapshot.ko' [elf64-x86-64] to `/tmp/initrd.Js4624/lib/dm-snapshot.ko' [elf64-x86-64]
/sbin/lvm.static -> /tmp/initrd.Js4624/bin/lvm
/etc/lvm -> /tmp/initrd.Js4624/etc/lvm
`/etc/lvm/lvm.conf' -> `/tmp/initrd.Js4624/etc/lvm/lvm.conf'
/sbin/dmraid.static -> /tmp/initrd.Js4624/bin/dmraid
/sbin/kpartx.static -> /tmp/initrd.Js4624/bin/kpartx
Adding module uhci-hcd
Adding module ohci-hcd
Adding module ehci-hcd
Adding module jbd
Adding module ext3
Adding module scsi_mod
Adding module sd_mod
Adding module 3w-9xxx
Adding module libata
Adding module ahci
Adding module usb-storage
Adding module dm-mod
Adding module dm-mirror
Adding module dm-zero
Adding module dm-snapshot

Now we reboot, and it should boot sucessfully into xen.

Xen 3.2 on CentOS 5.1 x86_64 / RHEL 5.1 x86_64

Since my drivers are not signed, you will need to temporarily disable signature checking for yum.

# vi /etc/yum.conf
Make sure it says gpgcheck=0

Download the file and untar it.

# tar xvzf xen-3.2.0-CentOS5.1.tar.gz
xen-3.2.0-CentOS5.1/
xen-3.2.0-CentOS5.1/xen-devel-3.2.0-0xs.x86_64.rpm
xen-3.2.0-CentOS5.1/xen-3.2.0-0xs.x86_64.rpm
xen-3.2.0-CentOS5.1/xen-libs-3.2.0-0xs.x86_64.rpm

# cd xen-3.2.0-CentOS5.1

Install the RPMs.

# yum install -y xen-3.2.0-0xs.x86_64.rpm xen-libs-3.2.0-0xs.x86_64.rpm xen-devel-3.2.0-0xs.x86_64.rpm

It will download a bunch of dependencies and install them. Among them will be a new kernel - kernel-xen.

# vi /etc/yum.conf
Set gpgcheck back to the old value: gpgcheck=1 if it was originally 1.

The only problem at this point is that yum for some reason doesn't update the boot entry, so we have to do this manually.

# vi /boot/grub/menu.lst

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-53.1.21.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-53.1.21.el5
module /vmlinuz-2.6.18-53.1.21.el5xen ro root=/dev/VolGroup00/LogVol00
module /initrd-2.6.18-53.1.21.el5xen.img
title CentOS (2.6.18-53.1.21.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.1.21.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-53.1.21.el5.img
title CentOS (2.6.18-53.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-53.el5.img

We want to update the CentOS (2.6.18-53.1.21.el5xen) entry, and set it to use the proper kernel - xen.gz-3.2

This is what my updated menu.lst looks like - yours may differ. I have also set the default to 0, so that it boots my xen kernel automatically.

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-53.1.21.el5xen)
root (hd0,0)
kernel /xen.gz-3.2
module /vmlinuz-2.6.18-53.1.21.el5xen ro root=/dev/VolGroup00/LogVol00
module /initrd-2.6.18-53.1.21.el5xen.img
title CentOS (2.6.18-53.1.21.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.1.21.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-53.1.21.el5.img
title CentOS (2.6.18-53.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-53.el5.img

Once you reboot you should automatically boot into the xen kernel and be able to create virtual machines.

Creating sparse files on Linux

Sometimes it's usefull to create sparse files on Linux. For example, when you're creating Xen hard disk images, creating a sparse file will take up much less space then creating a fully allocated file, and will only start taking up space as it fills up.

dd if=/dev/zero of=filename.img bs=1k seek=128M count=1
This will create a sparse file of 128GB. Adjust the seek parameter to get the file size that you want.

If you need to find out the real space that the file is taking up, use du -lah

# du -lah
20K ./filename.img
28K .

Using ls will only show you how big the file is supposed to be

#ls -lah
total 36K
drwxr-xr-x 2 root root 4.0K Jun 5 13:59 .
drwxr-xr-x 3 root root 4.0K Jun 5 13:59 ..
-rw-r--r-- 1 root root 129G Jun 5 13:59 filename.img

BlogCFC was created by Raymond Camden.