Topic: backup/restore all partition tables of HDD
hi,
please add a function to backup\restore all partition tables of HDD (including extended partitions).
You are not logged in. Please login or register.
GParted forum → Feature Requests → backup/restore all partition tables of HDD
hi,
please add a function to backup\restore all partition tables of HDD (including extended partitions).
Hi,
I'm working on this issue to have an easy to use dialog steered script for that purpose, because it saved me from a big loss to have a backup of my MBR, which got unintentionally overwritten. The best is, that all necessary components are actually contained in the "GParted" distros, so that it has to be simply "puzzeled" together. Keywords : Hexadecimal Editor, Mounting Wizard, File Manager. Together with the snapshot utility it will improve the support in this forum: a picture is worth a thousand words.
As a preliminary information here is the console command("Terminal" icon) , which writes the MBR to a file. Let us assume your harddisk is device "hda" (you see it with "GParted"):
dd if=/dev/hda of=/root/hda.MBR bs=512 count=1
To have a look at it :
mc -v /root/hda.MBR
#Press [F4] to change to Hexadecimal view
Mount an USB stick (e.g. "sdb1"; attach it and refresh "GParted" by its icon to see its device name), finally copy MBR to it:
mkdir /mnt/usbstick
mount /dev/sdb1 /mnt/usbstick
mkdir /mnt/usbstick/BootRec
cp /root/hda.MBR /mnt/usbstick/BootRec
Regards
cmdr
Hi!
@ cmdr: shouldn't the second mkdir call be placed after the mount command? Mounting typically makes the contant of the directory used as mount point disappear - and lets the contents opf the mounted device show up there. Thus, with the commands in your order, the cp line will in fact copy the MBR backup to the USB key - but it will not write the file to the /BootRec folder there, since this folder does not exist on the USB key. Instead, a file named BootRec will be craeted - and this file contains the copy of the MBR.
Hi stormhead,
yes you are right ! I edited the post and corrected it.
Regards
cmdr
hi cmdr,
it is easy to backup MBR.
What I need is to backup the full HDD structure including extended partition consisting several logical drives.
Currently I know only one application supporting this function: Partition Table Doctor (http://www.ptdd.com/). Unfortunately it's not freeware.
Hi murad,
I just solved your problem with my newest version of "MC_HxEd" (= Midnight Commander hexadecimal Editor for Boot Records). The former version (without the wanted feature) is integrated in "GPartedLive" since version 0.3.9-13. The new feature, you need, is called "Store all Records", either of all attached drives or per drive. Of course it includes all structures of an extended partition. All records are stored to a USB key, which gets easily detected and mounted by my new version, so that you can operate "GParted" from a CD as usual.
How to get it work ?
1. Download the newest version from here.
2. Copy it to your USB-Stick.
3. Launch "Gparted"
4. Attach the USB key, wait a moment, until it gets detected (LED flickers).
5. Start Terminal and mount it, as I described it in my former post above, but use "/mnt/usb"
instead of "/mnt/usbstick", because I use the shorter path in my script. So it's at once ready for storage of Boot Records. "BootRec" is automatically created by my script.
6. Start "Midnight Commander" with "fluxbox" (right-click on the desktop; "File/System utilities"; "mc")
7. Search Folder "/mnt/usb" (sorry, mouse isn't working within "mc"),
highlight "MC_HxEd" and press [Enter].
If you want to do a step more, you could copy "MC_HxEd" to folder "/usr/bin", thus overwriting the older version, shipped with "Gparted". Of course this is no permanent storage. But you can then start the new "MC_HxEd" easily with "fluxbox" and disconnect or change the USB key.
It's also a good idea to store some screenshots of Gparted's GUI before and after you apply changes (which gets very simple with my program).
Happy New Year
cmdr
Hello, cmdr!
First thank you for you brought me in to the world of terminal use, which earlier was the scariest thing on earth for me. ))) First I just wanted to delete Vista with gparted on my moms computer partition it and install XP then, but I faced some troubles, cause I didn't know how to set the flags to active. After reading different tutorials for an hour i decided it might be a good idea to back up the MBR first and found your post reply. And it actually came out to be not so scary as I thought and it worked out to save MBR on usbstick!!! I was wordless, writing in terminal with success was not my primary intention, and at the the and found myself plying around with the terminal in gpartet for two and a half hours...=))))
After that, and this is the actual question, I thought, it might be better not just to erase the HDD but to backup the recovery partition first( which was there already, fat32), just for the case.
The one thing I didn't figure out yet, is how to use your program MC_HxEd, i just could look at the code in the mc, but no idea how to use it, to save the recovery partition to another place.
My gparted version is 0.3.4-11.
The second thing is, that I just have a usbstick with 2 GB, but the recovery data is nearly 4 GB.
I have a second notebook here, and thought to connect the two with a network cable to save the recovery data directly to my notebook. ( Or maybe its possible to save recovery data in two times on the usb)
Another question I have, is, do I have to be cafefull with anything else if later I suddenly want to reinstall vista on the notebook or another programm? Are there additionaly any general things to be aware of ? Is it ok just to erase the whole disk and then work farther?
Would you maybe help me in this thing? I would very apprecciate it! ))
Olga
Please, don't post support questions in the request section.
Olga, I'd like to ask you to open a new topic in the "Support/Live media" section for this last problem.
Sorry, you're right. It was not the best idea to post here, I will write in Support.
Hi murad,
I just solved your problem with my newest version of "MC_HxEd" (= Midnight Commander hexadecimal Editor for Boot Records). The former version (without the wanted feature) is integrated in "GPartedLive" since version 0.3.9-13. The new feature, you need, is called "Store all Records", either of all attached drives or per drive. Of course it includes all structures of an extended partition. All records are stored to a USB key, which gets easily detected and mounted by my new version, so that you can operate "GParted" from a CD as usual.
How to get it work ?
1. Download the newest version from here.
2. Copy it to your USB-Stick.
3. Launch "Gparted"
4. Attach the USB key, wait a moment, until it gets detected (LED flickers).
5. Start Terminal and mount it, as I described it in my former post above, but use "/mnt/usb"
instead of "/mnt/usbstick", because I use the shorter path in my script. So it's at once ready for storage of Boot Records. "BootRec" is automatically created by my script.
6. Start "Midnight Commander" with "fluxbox" (right-click on the desktop; "File/System utilities"; "mc")
7. Search Folder "/mnt/usb" (sorry, mouse isn't working within "mc"),
highlight "MC_HxEd" and press [Enter].If you want to do a step more, you could copy "MC_HxEd" to folder "/usr/bin", thus overwriting the older version, shipped with "Gparted". Of course this is no permanent storage. But you can then start the new "MC_HxEd" easily with "fluxbox" and disconnect or change the USB key.
It's also a good idea to store some screenshots of Gparted's GUI before and after you apply changes (which gets very simple with my program).Happy New Year
cmdr
hi cmdr,
I tried what you advised me to do. Unfortunatelly I failed to get what I wanted: full HDD structure backup.
For testing I prepared Hard Drive with Primary Partition (NTFS) and Extended Parition consisting of two Logical Partitions (NTFS also).
After launching MC_HxEd it showed the following:
Choosing sda, sda1, sda2, sda5 and sda6 and clicking OK I've got sda.MBR, sda1.PBR up to sda6.pbr respectively saved on flashdisk.
It was backup-part. Please suggest what should I do to restore the structure of my HDD.
Hello Murad,
Please suggest what should I do to restore the structure of my HDD
Well, I think, that an easy accessible way to get a stored Boot Record back on a drive is like a key to a "poison cabinet" in the wrong hands. It would be simple to integrate it, due to the naming convention of the files. But what if you use a removable storage media, that changes its device name, because it's accidentally attached after an other ? DriveID might also have been altered with the changes, you want to get rid of again, so there is no more "fingerprint" for identification.
In other words, you have to do it manually with Terminal command "dd", which I use in my program, too.
Example for MBR on /dev/sdc
dd if=/mnt/usb/BootRec/sdc.MBR of=/dev/sdc bs=512 count=1
Example for PBR on /dev/sdb3
dd if=/mnt/usb/BootRec/sdb3.PBR of=/dev/sdb3 bs=512 count=1
Since you can recall and edit the commandline with the arrow keys, you simply have to type a few new characters (2 to 8) for each record.
A little more difficult are the XBRs, because they don't have a "device name". You need their absolute sector location on your media. And this is my concession with a new version of MC_HxEd: I will integrate it in the filename as with BLK files, e.g. "sdb3_3456789_1.XBR", which means "start at sector 3456789, one sector contained".
Actually you have to consult the drive information print-out of "MC_HxEd". Look for the appropriate logical volume within the extended partition and its start sector value. Subtract 63 and the result is the absolute sector location of the associated XBR. BTW, it's also +1 sector from the end of a preceeding logical volume, or if it's the first, it's equal to the start sector of the extended partition. Unallocated space is NOT possible between logical volumes, but behind the last one and the end sector of the extended partition.
Example: /dev/sdb3 , start 29302623 ( - 63 = 29302560 )
Note, that our target (of=) is the physical drive "/dev/sdb" here as with MBR !
dd if=/mnt/usb/BootRec/sdb3.XBR of=/dev/sdb skip=29302560 bs=512 count=1
Thanks for your suggestions
cmdr
Hi cmdr,
Let me explain what task I try to solve with your program.
Several months ago I purchased new harddisk. I have partitioned it so I had two Primary Partitions and Extended Partition with several logical drives in it. I installed several different OSes on several partitions, copied my data, then started to install one more OS. Something went wrong during OS installation and after reboot I found out that I had only primary partitions on my hard disk, extended partition (holding several logical drives with data) was gone. So now I'm looking for program to backup the structure of my hard disk.
Example for PBR on /dev/sdb3
dd if=/mnt/usb/BootRec/sdb3.PBR of=/dev/sdb3 bs=512 count=1
It means I should have sdb3 on my harddisk. what if it was removed like in my case I described above?
Hi Murad,
the possible success of recovering your HDD depends on what happened with the last installation. Did it write its programs and data only into an empty (logical ?) drive or did it repartition and format something. You can corrupt an extended partition simply by giving it a wrong fileID in its partition table in MBR, but if PBR and the volume space does not get overwritten (or formatted), everything is recoverable, if you saved the old structure (Partitioning/MBR and Boot Records/PBR,XBR).
So now I'm looking for program to backup the structure of my hard disk.
Does it mean, that you want to backup parts of the HDD, which are still accessible. Or do you mean direct recovery, so that no data or programs have to be copied to another drive.
As you might guess, we need exact data and files of the state before and after.
Regards
cmdr
Hi cmdr,
Does it mean, that you want to backup parts of the HDD, which are still accessible. Or do you mean direct recovery, so that no data or programs have to be copied to another drive.
Yes, I mean direct recovery. Because partition wasn't formatted, files actually were there, only partition tables were removed.
It's like if I have several primary partitions and extended partition with several logical drives and all these volumes have data. Then I backup logical structure of my HDD with your program, launch Windows disk manager and delete all partitions. Then I start your program again and recover the structure: all partitions and data on it should be like it was before partitions deletion.
Thank you very much for the explanation! I for some reason had the bug for remote access to the system. That is when I used proxy. Have no idea what it involves. I hope that in time this feature will disappear.
GParted forum → Feature Requests → backup/restore all partition tables of HDD
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 2 official extensions. Copyright © 2003–2009 PunBB.