pmpatrick Posted July 20, 2004 Report Share Posted July 20, 2004 If you play around with paritioning tools, installing linux disros, or writing bootloaders to the mbr long enough, sooner or later you will corrupt your partition table in the MBR. Then you have real problems trying to restore a corrupted partition table. With a little forsight and linux you can avoid those problems by making a backup of your mbr which you can restore if everything goes bad. It's relatively easy to do using the dd command. To backup the mbr to a floppy just run: # dd if=/dev/hdx of=/dev/fd0 bs=512 count=1 where 'x' is your boot hard drive, i.e. the one where your mbr is located. The mbr is on the first sector of your hard drive which is 512 bytes. The above command merely copies the first 512 bytes on sector 1 to a floppy. To restore the mbr from the floppy backup, boot off a rescue cd like knoppix, open a console and get root privileges, then run: # dd if=/dev/fd0 of=/dev/hdx bs=512 count=1 If you don't have a floppy drive, you can backup the mbr to a file on your hard drive and copy the file to a cd-r if you have a cd burner. To backup to your hard drive run: # dd if=/dev/hdx of=mbr.bak bs=512 count=1 This will create a file mbr.bak in your current working directory. Obviously, if your partition table is trashed, you will never be able to access that file on your hard drive so you need to place it on some removable medium. Just create a data cd and copy mbr.bak to the cd-r with your favorite cd burning program. Restoring from a cd-r backup is essentiall the same except you have to mount the cd-r and run: # dd if=<cd drive mount point/mbr.bak> of=/dev/hdx bs =512 count=1 Note, if you have resized or altered any of the existing partitions since you backed up this problably won't work. If you just created some new partitions physically located on the hard drive after your existing partitions, the mbr backup should leave the partition table in the same state it was in before you created the new partitions, i.e. the new partitions will be deleted and the prior working partition table with the old partitions should be restrored. Quote Link to comment Share on other sites More sharing options...
Gowator Posted October 7, 2004 Report Share Posted October 7, 2004 this is a prety fundamental show stopper (if not done so Im pinning it) Quote Link to comment Share on other sites More sharing options...
aRTee Posted October 7, 2004 Report Share Posted October 7, 2004 Just for those who don't have any experience and didn't realise that they should/could have done this, most harddrive manufacturers actually have tools for download that can restore a previous partition table. I have had to use such a tool and got to choose any of the previous 10 (or was it 15) partition tables, indicated by date. If there ever was a good reason to make sure the bios has the date set correctly... So, in case you didn't save your partition table, you can (sometimes/usually?) still restore the old one. Quote Link to comment Share on other sites More sharing options...
roly Posted October 25, 2008 Report Share Posted October 25, 2008 My problem is I tried to set up a dual boot with Mandriva 2008 and XP and it turned out that Mandriva did not have the drivers to properly handle a SATA drive.(My Bad) :unsure: I found a windows utility called "MbrFix.exe" but I have not used it before and am concerned about screwing his pc even more. Has anyone tried this? How did you use it and what where the results? He does not have the restore cd, it's a Dell PC. Linux Rulez! Roly Quote Link to comment Share on other sites More sharing options...
Guest PauLLiK Posted July 3, 2010 Report Share Posted July 3, 2010 You can use Clonezilla, that way you can clone a whole partition and then restore it. No losses. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.