Книга: Fedora™ Unleashed, 2008 edition

Backing Up and Restoring the Master Boot Record

Backing Up and Restoring the Master Boot Record

The Master Boot Record (MBR) is the first 512 bytes of a hard disk. It contains the boot loader code in the first 446 bytes and the partition table in the next 64 bytes; the last two bytes identify that sector as the MBR. The MBR can become corrupted, so it makes sense to back it up.

This example uses the dd command as root to back up the entire MBR. If the boot loader code changes from the time you make this image and restore the old code, the system will not boot when you restore it all; it is easy enough to keep a boot floppy disk handy and then rerun LILO if that is what you are using.

To copy the entire MBR to a file, use this:

# dd if=/dev/hda of=/tmp/hdambr bs=512 count=1

To restore the entire MBR, use this:

# dd if=/tmp/hdambr of=/dev/hda bs=512 count=1

To restore only the partition table, skipping the boot loader code, use this:

# dd if=/tmp/hdambr of=/dev/hda bs=1 skip=446 count=66

Of course, it would be prudent to move the copy of the MBR to a floppy disk or other appropriate storage device. (The file is only 512 bytes in size.) You will need to be able to run dd on the system to restore it (which means that you will be using the Fedora rescue disc, as described later, or any equivalent to it).

Оглавление книги


Генерация: 2.188. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз