[CentOS] Can't get Grub work on clone of machine

Tue Jul 17 00:20:55 UTC 2012
Gregory Machin <gdm at linuxpro.co.za>

On Tue, Jul 17, 2012 at 3:14 AM, Les Mikesell <lesmikesell at gmail.com> wrote:
> On Mon, Jul 16, 2012 at 12:15 AM, Gregory Machin <gdm at linuxpro.co.za> wrote:
>> I have cloned a RHEL 5.6 physical server over to a ESXi 5.0 Virtual Machine.
>> Using a live CD on the new Virtual Machine I created 3 partition /boot
>> (/dev/sda1), / (/dev/sda2) and swap (/dev/sda3), I then mounted the /
>> (sda2) partition and created the /boot directory and mount the boot
>> partition partition /dev/sda1 into /boot. I then used rsync to copy
>> the source machine over to the Virtual Machine.
>> I have not been able to get Grub to go further than :
>> GRUB Loading stage1.5.
>> GRUB Loading, please wait...
>> Error 2
> First, if your source layout is typical, you might have been able to
> use the free VMware Converter tool to clone to ESXi (or an image)
> directly.   Most of my linux boxes have a custom raid layout and don't
> work so I don't have much linux experience with it, but it works great
> with windows.
> Another approach is to do a minimal install, upgrade the kernel to
> match the source machine, then blow away everything but the /boot
> partition and copy over from the source.  This gets grub installed and
> the right kernel modules in the ramdisk to match the new hardware -
> and you can look at /etc/modprobe.conf to see what those modules are
> if you don't know as much as anaconda does about hardware and modules.
> But, starting from what you have, stage 1.5 is still in the MBR so it
> seems odd that you have enough to boot at all but are missing that
> part.    I'd try booting in rescue mode, running grub and:
> root (hd0,1)
> setup (hd0)
> quit
> --
>    Les Mikesell
>     lesmikesell at gmail.com

Hi Les.

I started with VMware standalone converter 4.3 and the 5.0 and
couldn't get it to work, but it worked fine when converting another
machine to the same ESXi host.

Following these instructions :
mount /dev/sda1 /mnt/sysimage/boot
mount -t none /dev /mnt/sysimage/dev -o bind
chroot /mnt/sysimage/boot
mount /proc
mount /sys


root (hd0,1)
setup (hd0)

I get the following:
root (hd0,1)
 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

I have checked that the stage1 file is in /boot/grub/ So Im confused.