Oh no, I’ve created a monster!

I have started to do benchmarking with virtual machines under opensuse 11.3 with KVM and had setup a number of different domains to run the same OS under different settings. Just one minor issue occurred which was that some domains with device emulation for the disk wouldn’t startup anymore. Very strange since I tested this before, starting from a working setup with disk emulation and then switching to the virtio drivers.

After some troubleshooting it appears it has to do with the drivers that are loaded at boot time through the init ram disk. Apparently, when creating the init ram disk under an OS with virtio drivers, it does not automatically load the drivers for IDE and SCSI, so disk emulation does not work.

The problem is easily illustrated by the output of mkinitrd on the guest using IDE emulation:

Kernel image:   /boot/vmlinuz-2.6.34.7-0.5-default
Initrd image:   /boot/initrd-2.6.34.7-0.5-default
Kernel Modules: thermal_sys thermal scsi_mod libata ata_piix ata_generic processor fan virtio virtio_pci virtio_ring virtio_net virtio_blk dm-mod dm-snapshot crc16 jbd2 ext4 pata_sl82c105 pata_hpt3x2n sata_mv pata_sch pata_netcell pata_acpi pata_sc1200 pata_it8213 sata_vsc pata_serverworks sata_via pata_ns87415 ahci pcmcia_core pcmcia pata_pcmcia pata_mpiix pata_jmicron pata_piccolo sata_svw sata_inic162x pdc_adma pata_atp867x pata_ali pata_hpt3x3 pata_efar pata_marvell pata_sil680 pata_cs5530 pata_pdc202xx_old sata_sil pata_it821x sata_sil24 pata_cypress pata_opti sata_promise sata_nv pata_optidma pata_sis pata_hpt37x pata_cmd640 pata_artop pata_amd sata_qstor sata_uli pata_cs5520 sata_sis pata_radisys pata_rz1000 sata_sx4 pata_cmd64x pata_ns87410 pata_triflex pata_hpt366 pata_ninja32 pata_via pata_rdc pata_atiixp pata_pdc2027x pata_oldpiix sd_mod usbcore mmc_core ssb ohci-hcd ehci-hcd uhci-hcd usbhid linear
Features:       dm block usb lvm2 resume.userspace resume.kernel
Bootsplash:     openSUSE (800×600)

compared to the output on the same guest using virtio drivers:

Kernel image:   /boot/vmlinuz-2.6.34.7-0.5-default
Initrd image:   /boot/initrd-2.6.34.7-0.5-default
Kernel Modules: thermal_sys thermal scsi_mod libata ata_piix ata_generic processor fan virtio virtio_pci virtio_ring virtio_net virtio_blk dm-mod dm-snapshot crc16 jbd2 ext4 usbcore pcmcia_core pcmcia mmc_core ssb ohci-hcd ehci-hcd uhci-hcd usbhid linear
Features:       dm block usb lvm2 resume.userspace resume.kernel
Bootsplash:     openSUSE (800×600)

I have configured the system to always include the virtio drivers by adding “virtio_blk” and “virtio_net” to /etc/sysconfig/kernel, so the initrd created on the guest with IDE emulation also works on the guest with virtio but not the other way around.

The solution/workaround here is quite simply to create a so-called monster initrd (mkinitrd -A) that has all available drivers available in the ram disk. Perhaps it doesn’t seem that nice, but the initrd is still only 20MB large compared to 6MB for a ‘normal’ initrd. So I created a monster!

This entry was posted in Devops/Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *