Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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