[H-GEN] Cleaning up the MBR on a /dev/hda

Ewan Edwards Edwards_Ewan_B at cat.com
Mon Nov 14 20:54:08 EST 2005


I made a mistake when installing Ubuntu recently on /dev/sdb.  By 
default the installer wants to put the bootloader stuff in the MBR 
of /dev/hda (if it exists) even if the OS is being installed 
on /dev/sdx.  That aside, I wasn't paying sufficient attention and 
now the system won't boot except from a CD or DVD (it doesn't have a 
floppy drive).  

I could go into a long story detailing what's happened and what I've 
done, but the upshot of it all is that I want to clear bootloader 
from the MBR on /dev/hda without destroying the partition table.

I could clear the MBR by booting one of the many live Linux distros, 
such as Knoppix, and runing dd thusly.  Unfortunately this will also 
have the undesirable result of clearing the partition table.
   dd if=/dev/zero of=/dev/hda bs=512 count=1

I could fit a floppy drive, boot DOS, and use it's fdisk utility with 
the /mbr switch.  Unfortunately, I have no desire to make any 
hardware mods, nor natively run any non GPL OS on this box - even if 
only temporarily.  As far as I know there is no equivalent function 
available in the version of fdisk that comes with most Linux distros.

The best idea I've had so far is to somehow capture the partition 
table information, then use dd as above, then somehow write the 
captured information back.

Suggestions gratefully accepted for the 'somehow' steps.





More information about the General mailing list