Grub disk: something automatic?

Rashkae ubuntu at
Thu Jan 28 14:24:55 UTC 2010

Dotan Cohen wrote:
>> Dotan, if we are talking only of grub-legacy not grub2, then at grub
>> prompt do a 'root' and 'setup' like
>> root (hd0,x)
>> setup (hd1)
>> But watch out for mapping if harddrive is not the master drive
>> Also you would need to update-grub first for that (hd,x). You cannot do
>> that at grub-prompt.
> The problem is that I often cannot boot, so I cannot perform
> update-grub. Also, most of my machines (other than the laptop) have
> multiple hard drives.

Hi Dotan, sorry I do not have an exact answer for you, but here are some 
suggestions to help with your situation.  Multiple hard drives can be a 
pain on modern Motherboards, because the Mobo can re-assign drive 
numbering on boot, (if you boot from CD-ROM on one controller then 
switch to a SATA hd on another controller, drive numbering between your 
IDE and SATA hard drives will be completed messed up.  Here are some 
strategies to alleviate the headaches:

1. If possible, arrange your hard drives so your primary linux partition 
is on your boot hard drives.  When bootstrapping grub, disconnect the 
other hard drives.  It's impossible for even grub to mix up the hard 
drive numbering when there is only hd0.  It will not matter how badly is inaccurate on future update-grub runs, since grub will now 
auto-fix itself based on UUID's.. (I'm really loving this new feature.)

2.  Install grub on the super-block of your filesystem  as well as the 
mbr.  (this won't work with XFS filesystem, since XFS does not leave 
space on the superblock)

ex: grub-install /dev/sda1

Then mark that partition as bootable in your partition editor.

That way, whenever another OS or disk utility messes your MBR, *any* 
bootloader or repair disk will be able to chainload your grub that is 
safely installed on the partition.  From the lowly dos fdisk /mbr (or 
lilo -m /dev/sda) to simply install an old style dos MBR will be enough 
to get your linux booting again.

While reading the grub documentation, I also saw reference that grub can 
now create it's very own boot partition to deal with these musical hard 
drive situations, which should be more reliable.  I haven't tested this 
myself yet (on to-do list) so can't offer guidance, but it's worth 
perusing the grub documentation wiki.

More information about the ubuntu-users mailing list