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

I have a hard drive with some partition for windows (NTFS) and 1 partition for linux and 1 partition for linux swap. Recently, I tried Norton Partition Magic Pro 8.05 (comes with Hiren Boot CD). It suggested me something related to ExtendedX. I choose [Fix] and then boom, after restart, my grub is corrupted (What's a magic!!!).

When I boot up using Ubuntu Live CD, this is the result of fdisk -l on my computer:

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x4ffe4ffd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2615    21004956    7  HPFS/NTFS
/dev/sda2            2616       14593    96213285    f  W95 Ext'd (LBA)
/dev/sda5            2616        4619    16097098+   7  HPFS/NTFS
/dev/sda6            4620       11459    54942268+   7  HPFS/NTFS
/dev/sda7           11460       11982     4200966    7  HPFS/NTFS
/dev/sda8           11983       14344    18972733+  83  Linux
/dev/sda9           14345       14593     2000061   82  Linux swap / Solaris

I find and follow an article here: http://gadgetmix.com/index/how-to-restrore-grub-bootloader-in-ubuntu-9-10-standard-and-netbook-remix/

But on my computer, when I try grub-install --root-directory=/mnt /dev/sda8 (which is my ubuntu main partition), the terminal returns error:

root@ubuntu:~# grub-install --root-directory=/mnt /dev/sda8
grub-probe: error: Cannot find a GRUB drive for /dev/sda8.  Check your device.map.

Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

What is that error? How can I fix that? Thanks.

share|improve this question

2 Answers 2

Try this:

chroot /mnt bash
mount -a
update-grub
grub-install /dev/sda8 # <- are you sure about this? (see below)
unmount -a
exit

About installing grub to a specific partition

If you do this, your boot loader needs to be aware that the partition has something interesting. Microsoft's bootloader is configured by editing c:\boot.ini. You do this by first copying the bootloader into a file:

dd if=/dev/sda8 of=grub.bin bs=512 count=1

Then saving grub.bin onto c:\grub.bin then add something like this to your c:\boot.ini:

c:\grub.bin="Linux (GRUB)"

If you don't understand any of that, don't bother. Read the next section.

About installing grub to the master boot record

Grub is the better boot loader. Putting it in the master boot record lets you use it to start Windows, instead of the other way around.

Before you continue, check your grub configuration file after running update-grub to make sure it "knows" about Windows:

cat /boot/grub/grub.cfg # used for grub2 users
cat /boot/grub/menu.lst # used for grub1 users

Whatever you're using, look for lines that indicate something about Windows, and your (hd0,0) device. When you're satisfied, simply chroot like before and then:

grub-install /dev/sda # <- note this installs to the "master boot record"

When you reboot, Grub will start, and you can pick Windows. If you had entries to boot Linux/Grub in your boot.ini file, you can delete them now.

The only downside to this method is that Microsoft Windows may delete grub as part of a system update, or general incompetence. Using the ubuntu disk and simply re-running update-grub and grub-install may be easier than dealing with grub.bin

share|improve this answer

as the how-to stats, change

grub-install --root-directory=/mnt /dev/sda8

to

grub-install --root-directory=/mnt /dev/sda
share|improve this answer
    
Flew, it produces the same error –  Phuong Nguyen Feb 4 '10 at 2:36

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.