0

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.

2 Answers 2

1

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

0

as the how-to stats, change

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

to

grub-install --root-directory=/mnt /dev/sda
1
  • Flew, it produces the same error Feb 4, 2010 at 2:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .