Migrate CentOS VM using LVM on IDE to run with VirtIO

Jerry Seutter asked:

I’m trying to migrate existing IDE-using, LVM-based CentOS 5.2 VMs to use virtio. The symptom is a kernel panic upon boot when the system can’t find any volume groups. Does anyone know how to make this work?

I created a vm install that didn’t use LVM and was able to switch it over to use virtio. This is the where I’ve gotten to when using LVM:

Steps:

  1. Install CentOS 5.2 in kvm, which uses LVM, on an ide disk.
  2. Install a newer kernel with virtio support, in my case, 2.6.18-371.6.1.el5.centos.plus and modify configs (detailed below).
  3. Shut down the system. Change the disk type to virtio in the virt-manager config.
  4. Boot and select the new kernel at the grub prompt. “No volume groups found” and a kernel panic.

In the second step above, I updated /boot/grub/device.map, /etc/modprobe.conf, and re-ran mkinitrd.

/boot/grub/device.map:

# this device map was generated by anaconda
(hd0)     /dev/vda

/etc/modprobe.conf:

alias eth0 virtio_net
alias scsi_hostadapter virtio_blk
alias snd-card-0 snd-hda-intel
options snd-card-0 index=0
options snd-hda-intel index=0
remove snd-hda-intel { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-hda-intel

/boot/grub/grub.conf:

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-371.6.1.el5.centos.plus)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-371.6.1.el5.centos.plus ro root=/dev/VolGroup00/LogVol00
    initrd /initrd-2.6.18-371.6.1.el5.centos.plus.img

I uncompressed the initrd image and the virtio modules appear to be there:

[root@localhost initrd]# ls -1 /tmp/initrd/lib/ | grep virt
virtio_blk.ko
virtio.ko
virtio_pci.ko
virtio_ring.ko

I upgraded to mkinitrd-5.1.19.6-80.el5_9 that uses lvm dumpconfig to generate lvm.conf:

[root@localhost initrd]# cat /tmp/initrd/etc/lvm/lvm.conf 
  devices {
    dir="/dev"
    scan="/dev"
    preferred_names=[]
    filter="a/.*/"
    cache_dir="/etc/lvm/cache"
    cache_file_prefix=""
    write_cache_state=1
    sysfs_scan=1
    md_component_detection=1
    ignore_suspended_devices=0
  }
  activation {
    missing_stripe_filler="/dev/ioerror"
    reserved_stack=256
    reserved_memory=8192
    process_priority=-18
    mirror_region_size=512
    readahead="auto"
    mirror_log_fault_policy="allocate"
    mirror_device_fault_policy="remove"
  }
  global {
    umask=63
    test=0
    units="h"
    activation=1
    proc="/proc"
    locking_type=1
    fallback_to_clustered_locking=1
    fallback_to_local_locking=1
    locking_dir="/var/lock/lvm"
  }
  shell {
    history_size=100
  }
  backup {
    backup=1
    backup_dir="/etc/lvm/backup"
    archive=1
    archive_dir="/etc/lvm/archive"
    retain_min=10
    retain_days=30
  }
  log {
    verbose=0
    syslog=1
    overwrite=0
    level=0
    indent=1
    command_names=0
    prefix="  "
  }

I checked for CONFIG_SYSFS_DEPRECATED like in this question, but that appears to be a post-2.6.18 option.

Does anyone know what is still missing?

My answer:


The solution is to update the system. Red Hat did not ship virtio guest drivers until 5.3.

At this point you’re nine service packs behind. Simply having kept the system up to date would have resolved the problem before it ever happened.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.