I have a virtual box running with CentOS, I am attaching new disk to existing centos VM and trying to install grub on this newly attached virtual disk. Later I will bring-up a second VM with newly prepared bootable hard-disk with custom root file-system and kernel.
I have tried following steps,
- Attached a new virtual disk to existing working centos machine.
- Created a new partition with
fdisk /dev/sdb. While portioning, given the options primary partition,partition number 1 and other options default. - Formatted the disk with
mkfs.ext3 /dev/sdb1. - Mounted the disk to
/media/new_drive. - Installed grub
grub-install /dev/sdb1 --root-directory=/media/new_drive/.
After this the second VM with newly prepared hard disk didn't come-up with error could not read from the boot medium ie MBR is not updated after grub-install, but I can see grub installed under /boot/grub in new drive.
But the worst thing is, it has corrupted my existing CentOS grub, CentOS VM hangs with black screen with only text GRUB.
Why grub-install /dev/sdb1 is not modifying MBR of sdb1? Is this not the right way to install grub on new drive?