[plug] restoring MBR the Linux way

Leon Brooks leon at brooks.smileys.net
Fri Feb 4 12:31:01 WST 2000


Tamara Thompson wrote:
>> Simply dd /boot/boot.$DEVICE back to the device. A normal IDE drive on
>> primary master has it's MBR saved into boot.0300

> hey, that's a bit shy of a 'howto'.  More detailed steps?  

> The '$DEVICE' threw me.

$SYMBOL in a shell script (or PHP, PERL, AWK, numerous other contexts)
is replaced by the contents of the variable SYMBOL. In this case, a
four-digit number corresponding to the device's magic number (3,0 for
/dev/hda, the first IDE drive).

Do a directory of /boot, you should see a file like this:

    -rw-r--r--    1 root     root     512 Aug  8  1999 boot.0300

That's where LILO saved your boot block.

To put it back, just do this...

    dd if=/boot/boot.0300 of=/dev/hda

...but note that this also restores your first four partition table
entries, so if you've changed your partition table since LILO made that
backup, you'll need to complicate things:

    dd if=/boot/boot.0300 of=/dev/hda ibs=432 count=1

The ibs= reads in 432-byte chunks (missing the partition table) and the
count= limits dd to only reading one of them.

In the case of my machine, there is no point in doing any of this, since
/boot/boot.0300 contains only zeroes and the partition table. This disk
has *never* had Windows on it.

> nobody shoot the bimbo, she's fully linux, if not fully
> knowledgeable yet

To infinity and beyond! (-:

-- 
Confidence is the feeling you have before you understand the situation.
If at first you don't succeed, try a shorter bungee. When in trouble,
when in doubt, run in circles, scream and shout. The two great secrets
of success are: don't tell anyone everything that you know.



More information about the plug mailing list