Restoring MBR
Jerry Feldman
gaf at blu.org
Sun Jan 2 08:15:32 EST 2005
On Sun, 2 Jan 2005 00:02:02 -0500
Bill Horne <bill at billhorne.homelinux.org> wrote:
> Well, I started the New Year off with a bang: I fat-fingered a dd
> command and I've overwritten the first 512 bytes of my mbr.
>
> Before I dig out the backups, please tell me if it's possible to
> recreate the MBR from the information in the existing partition
labels,
> or if there's a backup of the partition table that I can use.
You can have GRUB or LILO rebuild your MBR.
Boot a rescue CD, a standalone Linux, or boot your installed system from
a CD or floppy.
If you are using GRUB:
If you are booting from a rescue:
mount your root file system and chroot it.
mount your /boot if separate.
Execute the grub shell. Here is an excerpt from the GRUB docs.
Once started, GRUB will show the command-line interface (*note
Command-line interface::). First, set the GRUB's "root device"(1)
(*note Installing GRUB natively-Footnote-1::) to the boot directory,
like this:
grub> root (hd0,0)
If you are not sure which partition actually holds these files, use
the command `find' (*note find::), like this:
grub> find /boot/grub/stage1
This will search for the file name `/boot/grub/stage1' and show the
devices which contain the file.
Once you've set the root device correctly, run the command `setup'
(*note setup::):
grub> setup (hd0)
This command will install GRUB on the MBR in the first drive. If you
want to install GRUB into the "boot sector" of a partition instead of
the MBR, specify a partition into which you want to install GRUB:
grub> setup (hd0,0)
--
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.blu.org/pipermail/discuss/attachments/20050102/f2adf292/attachment.sig>
More information about the Discuss
mailing list