
Bypass the Boot Manager #3
Chapter 1, Booting Linux
|
7
HACK
Because of the bs=446 element, this command only restores the boot code in
the MBR. I purposely left out the last 66 bytes of the file so the partition
table would not be overwritten (just in case you have repartitioned or
changed any partition sizes since your last MBR backup). If you have acci-
dentally corrupted or deleted your partition table, restore the full 512 bytes
to the MBR with:
knoppix@ttyp0[knoppix]$ sudo dd if=mbr_backup of=/dev/hda bs=512 count=1
How Do I fdisk/mbr?
Knoppix also provides a useful tool called install-mbr that allows you to
manipulate the MBR in many ways. The most useful feature of this tool is
that it can install a “default” master boot record on a drive, which is useful if
you want to remove lilo or grub completely from the MBR so Windows can
boot by itself, or so you can install Windows to a hard drive that previously
used Linux. The results are the same as if you were to type
fdisk /mbr in
DOS. To remove the traces of lilo or grub from your MBR, run:
knoppix@ttyp0[knoppix]$ sudo install-mbr /dev/hda
Replace /dev/hda with your drive.
See Also
• The install-mbr manpage by typing man install-mbr in a console.
—Kyle Rankin
HACK
#3
Bypass the Boot Manager Hack #3
Save your system from a broken or missing kernel.
Of all the fantastic things you can do with your Linux box, one of the most
nerve-wracking activities is