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

Manually Restoring the Partition Table

Manually Restoring the Partition Table

A different way of approaching the problem is to have a printed copy of the partition table that can then be used to restore the partition table by hand with the Fedora rescue disc and the fdisk program.

You can create a listing of the printout of the partition table with fdisk by using the -l option (for list), as follows:

# fdisk /dev/hda -l > /tmp/hdaconfig.txt

or send the listing of the partition table to the printer:

# fdisk /dev/hda -l | kprinter

You could also copy the file /tmp/hdaconfig.txt to the same backup floppy disk as the MBR for safekeeping.

Now that you have a hard copy of the partition table (as well as having saved the file itself somewhere), it is possible to restore the MBR by hand at some future date.

Use the Fedora Rescue Disc for this process. After booting into rescue mode, you have the opportunity to use a menu to mount your system read/write, not to mount your system, or to mount any found Linux partitions as read-only. If you plan to make any changes, you need to have any desired partitions mounted with write permission.

After you are logged on (you are root by default), start fdisk on the first drive:

# fdisk /dev/hda

Use the p command to display the partition information and compare it to the hard copy you have. If the entries are identical, you have a problem somewhere else; it is not the partition table. If there is a problem, use the d command to delete all the listed partitions.

Now use the n command to create new partitions that match the partition table from your hard copy. Make certain that the partition types (ext2, FAT, swap, and so on) are the same. If you have a FAT partition at /dev/hda1, make certain that you set the bootable flag for it; otherwise, Windows or DOS will not boot.

If you find that you have made an error somewhere along the way, just use the q command to quit fdisk without saving any changes and start over. If you don't specifically tell fdisk to write to the partition table, no changes are actually made to it.

When the partition table information shown on your screen matches your printed version, write the changes to the disk with the w command; you will be automatically exited from fdisk. Restart fdisk to verify your handiwork, and then remove the rescue disc and reboot.

It helps to practice manually restoring the partition table on an old drive before you have to do it in an emergency situation.

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


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