Mohammedz.com

For Linux and Shell scripting.

Restore primary partition table without overwriting the MBR

Leave a comment


You can find this useful information from the manpage for gpart.

The gpart may be of some help when the primary partition table was lost or destroyed but it can under no circumstances replace proper disk/partition  table  backups. To save the master boot record (MBR) including the primary partition table to a file type

dd if=/dev/hda of=mbr bs=512 count=1

Exchanging /dev/hda with the block device name of the disk in question. This should be done for all disks in the system. To restore the primary partition table without overwriting the MBR type

dd if=mbr of=/dev/hda bs=1 count=64 skip=446 seek=446

Warning: make sure that all parameters are typed as shown and that the disk device is correct. Failing to do so may result in severe filesystem  corruption. The saved file should be stored in a safe place like a floppy disk.

~mohammed

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s