[CentOS-virt] Booting CentOS 5.5 (KVM) from a second disk

Tue Aug 24 13:57:51 UTC 2010
Daniel Bareiro <daniel-listas at gmx.net>

Hi all!

Doing some tests with CentOS 5.5 on a KVM virtual machine, after doing
the installation, I added a second disk. But when trying to boot from
it, I get the following error:

---------------------------------------------------------------------
root (hd1,0)

Error 21: Selected disk does not exist
---------------------------------------------------------------------


The two disks are Virtio devices that are recognized when booting from
the first disk:

---------------------------------------------------------------------
[root at localhost ~]# fdisk -l /dev/vda

Disco /dev/vda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Unidades = cilindros de 16065 * 512 = 8225280 bytes

Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/vda1   *           1        1174     9430123+  fd  Linux raid autodetect
/dev/vda2            1175        1305     1052257+  fd  Linux raid autodetect
[root at localhost ~]#
[root at localhost ~]#
[root at localhost ~]# fdisk -l /dev/vdb

Disco /dev/vdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Unidades = cilindros de 16065 * 512 = 8225280 bytes

Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/vdb1   *           1        1174     9430123+  fd  Linux raid autodetect
/dev/vdb2            1175        1305     1052257+  fd  Linux raid autodetect
---------------------------------------------------------------------

The idea of these tests is to set up software RAID1 on a running system,
since, as I said in another thread, it seems that Anaconda does not
support installation on degraded RAID.

But I'm not sure if this is a problem of Virtio or that GRUB is not
recognizing the second disk.

I made sure to modify /boot/grub/device.map with the entry for the new
disk:

---------------------------------------------------------------------
[root at localhost grub]# cat /boot/grub/device.map
# this device map was generated by anaconda
(hd0)     /dev/vda
(hd1)     /dev/vdb
---------------------------------------------------------------------

And the reconfiguration of GRUB on both disks did not give problems:

---------------------------------------------------------------------
[root at localhost grub]# grub --device-map=/boot/grub/device.map


    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the
possible
   completions of a device/filename.]
grub> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are
embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p
(hd0,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.
grub> root (hd1,0)
root (hd1,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1)
setup (hd1)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd1)"...  15 sectors are
embedded.
succeeded
 Running "install /boot/grub/stage1 (hd1) (hd1)1+15 p
(hd1,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.
grub> quit
quit
---------------------------------------------------------------------


Any idea what may be causing the problem?

Thanks in advance for your replies.

Regards,
Daniel