Linux – install grub on disk image

bootfilesystemsgrubinstallationlinux

I have disk image with 2 partitions:

  1. Partition 1 has cramfs file system (read only). This partition contains all system files of the OS
  2. Partition 2 has ext3 file system. This partition has only configuration files that may be changed.

How can I install GRUB1 boot loader on MBR.

I tried to copy first 446 bytes of my hard disk and copy GRUB files to the /boot directory on the 1st (cramfs) partition.

I cannot use grub-install because I have disk image and not disk itself.

Any ideas?

Best Answer

If I understand you correctly, you have made an image of some other system with /boot as partition 1, and the root filesystem as partition 2. The disk you have is the FIRST disk in the system you are trying to get it to work on.

First, get a DVD of a Linux system and boot the rescue system from the DVD. You should get a root shell prompt at some point.

  1. Run grub at the root shell prompt. You will get a grub> prompt

2a. Enter 'root (hd0,0)'

2b. Enter 'setup (hd0)'

2c. Enter 'quit'

If you get no errors on the above you should now have a bootable disk. There are some adjustments to the above depending on how much the configuration deviates from my assumptions.