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.
Hi Ken,
grub is a bit tricky to install in such setup. Try to use following script from within host machine - this works for me:
------------
losetup /dev/loop0 /dev/YOUR_VG/YOUR_LV kpartx -av /dev/loop0
ln -fs /dev/mapper/loop0p1 /dev/loop01 grub --device-map=/dev/null <<-END device (hd0) /dev/loop0 root (hd0,0) setup (hd0) END rm -f /dev/loop01 kpartx -dv /dev/loop0 losetup -d /dev/loop0
--------------
Best regards,
Nenad
Ken Bass wrote:
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.
CentOS-virt mailing list CentOS-virt@centos.org http://lists.centos.org/mailman/listinfo/centos-virt
On 01/12/2011 12:58 PM, Nenad Opsenica wrote:
Hi Ken,
grub is a bit tricky to install in such setup. Try to use following script from within host machine - this works for me:
Nenad, those commands worked as far as getting the grub installed. Thanks a lot!
When I boot now, I get GRUB loading, please wait... Error 2
I must be missing something else. I booted the rescue disk and did a mkinitrd with virtio_blk and virtio_pci just to be sure, but still get the same Error 2 after stage 1.5. I was sure to modify my grub.conf to ensure I added a /boot/ in front of all the paths since I am using a single partition for everything.
Did you set you /dev/vda1 as bootable?
On 01/12/2011 04:40 PM, Ken Bass wrote:
On 01/12/2011 12:58 PM, Nenad Opsenica wrote:
Hi Ken,
grub is a bit tricky to install in such setup. Try to use following script from within host machine - this works for me:
Nenad, those commands worked as far as getting the grub installed. Thanks a lot!
When I boot now, I get GRUB loading, please wait... Error 2
I must be missing something else. I booted the rescue disk and did a mkinitrd with virtio_blk and virtio_pci just to be sure, but still get the same Error 2 after stage 1.5. I was sure to modify my grub.conf to ensure I added a /boot/ in front of all the paths since I am using a single partition for everything.
CentOS-virt mailing list CentOS-virt@centos.org http://lists.centos.org/mailman/listinfo/centos-virt
On 01/12/2011 01:42 PM, Bruno Ribeiro da Silva wrote:
Did you set you /dev/vda1 as bootable?
I actually had forgotten about that. But after doing so, the error message remains the same.
According the grub documentation, stage 1.5 error 2 means: "2 : Bad file or directory type This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO."
On 01/12/2011 01:54 PM, Ken Bass wrote:
On 01/12/2011 01:42 PM, Bruno Ribeiro da Silva wrote:
Did you set you /dev/vda1 as bootable?
I actually had forgotten about that. But after doing so, the error message remains the same.
According the grub documentation, stage 1.5 error 2 means: "2 : Bad file or directory type This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO."
More info...After comparing my working system with the non-working one. I notice the non-working ext3 filesystem has an inode size of 256. The working system 128. Could this be the issue with grub? I see some ramblings on the Internet about grub and inode size issues.
On 01/12/2011 02:04 PM, Ken Bass wrote:
More info...After comparing my working system with the non-working one. I notice the non-working ext3 filesystem has an inode size of 256. The working system 128. Could this be the issue with grub? I see some ramblings on the Internet about grub and inode size issues.
This was the problem. When I created the ext3 filesystem in the Fedora 14 host for the Centos 5.5 guest, it must have used 256 byte inodes. GRUB did not like this. After formatting to 128 byte inodes (mkfs.ext3 -I 128), GRUB works. Not only did grub work, but I was able to boot using a rescue disk and issue the
device (hd0) /dev/vda root (hd0,0) setup (hd0)
sequence to install GRUB properly without any loopback tricks in the host.