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?


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.

  • I have an image of the hard disk, not the physical disk itself – Dima Jun 20 '11 at 23:05
  • This works on a VM if that is what you have. – mdpc Jun 20 '11 at 23:14
  • In order to do it, I need to write the image to the physical disk. I'm looking for the solution that I can run from the script automatically because my image is an image of the embedded device and I need to perform this operation every time when I'm compiling the SW. – Dima Jun 21 '11 at 16:44
  • I found the solution: In the GRUB configuration I added: device (hd0) <image_file_name.img> command. – Dima Jun 24 '11 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.