Skip to main content

How to install grubGRUB on a new drive?

I have a virtual box running with CentOS,.

I am attachinghave attached a new virtual disk to the existing centosCentOS VM and I'm now trying to install grubGRUB on this newly attached virtual disk. 

Later, I will bring-up up a second VM with a newly prepared bootable hard-disk disk with a custom root file-systemfilesystem and kernel.

I have tried the following steps,:

  • Attached a new virtual disk to the existing working centosCentOS machine.
  • Created a new partition with fdisk /dev/sdb. While portioningpartitioning, givenI chose the options primary partition,partition partition number 1 and other options default options.
  • Formatted the disk with mkfs.ext3 /dev/sdb1.
  • Mounted the disk to /media/new_drive.
  • Installed grubGRUB grub-install /dev/sdb1 --root-directory=/media/new_drive/.

After this, the second VM with the newly prepared hard disk didn't come-up withboot; I got the error: could not read from the boot medium ie. It seems the MBR is not updated after grub-installgrub-install, but I can see grubGRUB installed under /boot/grub inon the new drive. But

But the worst thing is, it has corrupted my existing CentOS grub,GRUB: The CentOS VM hangs withshowing a black screen with the only text being GRUB.

Why grub-installdoes /dev/sdb1 isgrub-install /dev/sdb1 not modifyingmodify the MBR of sdb1? Is this not the right way to install grubGRUB on new drive?

How to install grub on a new drive?

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?

How to install GRUB on a new drive?

I have a virtual box running with CentOS.

I have attached a new virtual disk to the existing CentOS VM and I'm now trying to install GRUB on this newly attached disk. 

Later, I will bring up a second VM with a newly prepared bootable hard disk with a custom root filesystem and kernel.

I have tried the following steps:

  • Attached a new virtual disk to the existing working CentOS machine.
  • Created a new partition with fdisk /dev/sdb. While partitioning, I chose the options primary partition, partition number 1 and other default options.
  • 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 the newly prepared hard disk didn't boot; I got the error: could not read from the boot medium. It seems the MBR is not updated after grub-install, but I can see GRUB installed under /boot/grub on the new drive.

But the worst thing is, it has corrupted my existing CentOS GRUB: The CentOS VM hangs showing a black screen with the only text being GRUB.

Why does grub-install /dev/sdb1 not modify the MBR of sdb1? Is this not the right way to install GRUB on new drive?

Source Link
Renjith
  • 241
  • 1
  • 2
  • 8

How to install grub on a new drive?

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?