Skip navigation

Erased drive:If I know what partitions I had, how do I rebuild my partition table (GPT)

1199 Views 14 Replies Latest reply: Jan 17, 2013 9:08 PM by MrElvey RSS
MrElvey Level 1 Level 1 (25 points)
Currently Being Moderated
Jan 17, 2013 3:21 PM

(Yes, I've  googled a bunch and read threads like this one already.)


What can I use - gpt or some other tool - to recreate/unerase a partition table and effectively undo an unintentional disk erasure completely?  That is, how can I rebuild a disk's GPT/GUID partition table?)  I don't want to do the file scavenging type recovery.  I didn't do a secure delete, so I think all the actual partitions are still there, undamaged.


What happened: Instead of erasing a single partition off a disk with many partitions, the entire partition table was erased (using Disk Utility, w/o deleting the underlying files).  Somehow the "Erasing a disk deletes all data on all its partitions." warning message was missed.


I have a copy of the output of df, with the number of blocks in each partition, from just prior to the erasure, so I should be able to recreate the GPT/GUID partition table.  Editing the GPT with a hex editor is not feasible.  Simply recreating the partitions with Disk Utility will overwrite the key filesystem tables on each partition, and I don't want to do that, plus Disk Utility doesn't allow me to specify exact partition sizes anyway.

Surely there's an app for rebuilding the partition table (other than emacs' hexl-mode!) for recreating/unerasing a partition table when the partition sizes and orders are known?  I've looked at the advertising for a bunch of recovery software and none of them clearly indicate that they will do what I want. 


I guess I can try using gpt on a copy of the reformatted drive I've made with dd, and see what happens.  But perhaps someone knows of a tool that should do what I need, or knows if gpt is that tool or not.


There are answers and tools that will do FILE recovery - search for files and recover the ones that aren't fragmented or deleted.  As far as I can find, they just look for files on the disk, and don't pay much, if any attention to the filesystem info or directory heirarchy, which in this case is valuable.  Of course I could send it in to DriveSavers, or the like.  But none of that seems necessary, and the scavenging file recovery apps won't do the job well,

E.g. some are mentioned here:


Thanks for any help.


The links in this post are to pages describing the underlined term, e.g. the man pages for df and gpt.

OS X Mountain Lion (10.8.2), SSD, USB, FireWire, external drives
  • macjack Level 9 Level 9 (50,445 points)

    Your best shot at recovery is  Prosoft Data Rescue  There is a free trial to see if it can recover what you need. But don't do another process on that drive until you've downloaded and run it.


    To format the disk boot up holding command-r keys into your Recovery Volume.

    The screen should give you these choices...


    Restore from TM backup

    Reinstall Mac OS X

    Get help online

    Disk Utility


    Choose Disk Utility > Choose your HDD > Choose the Partition tab and make it Mac Extended Journaled.

    You can then recreate the partitons by dragging or entering the actual size in GB.

  • Barney-15E Level 7 Level 7 (33,270 points)

    and yet you gave me instructions on how to to exactly what I said I don't want to do - instructions that would destroy my data.


    But don't do another process on that drive until you've downloaded and run it.


  • macjack Level 9 Level 9 (50,445 points)

    I'm suggesting that utility because it's been known to work where others have failed. I couldn't care less if you use it or not. I have no skin in the game. I'm just trying to help.


    Just what you don't want to do is probably your only option here, if you can't recover the files.


    I thought you were selling DriveSavers!

  • Barney-15E Level 7 Level 7 (33,270 points)

    MrElvey wrote:


    Your point, Barney? 

    He also said:


    Choose Disk Utility > Choose your HDD > Choose the Partition tab and make it Mac Extended Journaled.

    You can then recreate the partitons by dragging or entering the actual size in GB.


    Hmmm, indeed.


    It seems like macjack has given lots of good advice, and Level 8 and all.  But bad advice is bad advice, even if preceeded by other (questionable) advice.

    His advice was to use a data recovery tool, and do absolutely nothing else prior. Sounds like pretty good advice.

    Once you've completed that task, you'll need to reformat the drive.

    I'm not sure why all of that is confusing to you.

  • Linc Davis Level 10 Level 10 (107,550 points)

    ...or knows if gpt is that tool or not.


    It's not. Creating a new partition table with the same size partitions as the one you deleted, which is all you can do with gpt, won't cause the data to magically reappear. You'll have a partitioned empty drive, and less chance of recovering anything than you have now.


    Data recovery is a job for experts. You mentioned DriveSavers. If the lost data is worth to you what they charge, pay it.

  • johnl927 Level 3 Level 3 (565 points)

    You might want to look into this and give it a try to recover your partition table on your Mac, click here and its free


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.