[CentOS-virt] Centos 5.5 KVM GRUB / Virtio issue

Wed Jan 12 17:48:52 UTC 2011
Ken Bass <kbass at kenbass.com>

I have a virtual machine that had been running fine using a RAW disk 
image (IDE).

I am in the process of converting this virtual machine to use a single 
LVM and virtio. (For LVM backup snapshots and easy resizing purposes (no 
LVM within the guest))

I create the LVM and copied all the files from the existing RAW image to 
an ext3 under the LVM.

However, I cannot get it to boot. It has to do with GRUB and I cannot 
figure out why the stupid thing is not working as it should.

I boot the guest using the Centos 5.5 DVD and select Rescue and chroot 
/mnt/sysimage

<><>

fdisk -l shows:

Disk /dev/vda: 21.4 GB, 21474836480 bytes
213 heads, 34 sectors/track, 5791 cylinders
Units = cylinders of 7242 * 512 = 3707904 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/vda1               1        5792    20970496   83  Linux

<><>

cat /boot/grub/device.map  shows:
(hd0)    /dev/vda

<><>

However grub cannot find the /boot/grub/stage1.

I ran grub and did the following:

device (hd0) /dev/vda
  OK

root (hd0,0)
   Filesystem type is ext2fs, partition type 0x83

setup (hd0)

  Checking if "/boot/grub/stage1" exists... no
  Checking if "/grub/stage1" exists... no
Error 2: Bad file or directory type

find /boot/grub/stage1
Error 15: File not found

<><>

However, there is most definitely a /boot/grub/stage1 in the (hd0,1) - I 
copied the entire boot directory from the RAW IDE image to the LVM.
Even 'find /sbin/init' fails. Now find works at all.

My host is Fedora 14.

What is odd is that I created a different virtual machine by going 
through the whole Centos 5.5 DVD Install process and that one works. In 
this non working case, I've copied the files over to the LVM and it 
seems GRUB is the only issue/difference. I can boot the DVD installed 
one and run the above grub find command and it finds the stage1 fine.