GPT Overwritten

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
Glassmenagerie
Posts: 4
Joined: 17 Apr 2023, 20:47

GPT Overwritten

#1 Post by Glassmenagerie »

I accidentally over wrote my GPT using DD. My 1TB HD (/dev/sda) was showing signs of failure so I bought a 500G Samsung thinking I could clone the larger HD to the smaller SSD (/dev/sdb). Well, I mixed up the commands in an attempt to copy the HD GPT table over to the SSD. You can imagine the result. Basically a blank GPT on my HD.

I did an analysis using testdisk. Everything seems okay except for the Windows 10 reserve partition, sda2.

I didn't create a backup. Is there a way to get the GPT back?

Regards,
RDL
User avatar
cgrenier
Site Admin
Posts: 5441
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: GPT Overwritten

#2 Post by cgrenier »

If you run TestDisk, Analyze, Quick Search (and maybe Deeper Search) and get the correct partitions, choose Write, confirm, Quit.
But honestly I don't see how after overwriting half your disk, you will be able to recover your data.
You may be able to recover your data only if the cloning failed and few data have been overwritten.

If too much data have been overwritten for TestDisk to recover your partition, it still possible to use PhotoRec to recover data but
recovered files will not have their original filenames.
Glassmenagerie
Posts: 4
Joined: 17 Apr 2023, 20:47

Re: GPT Overwritten

#3 Post by Glassmenagerie »

Mr Grenier,

Thanks for responding! I used this command: sgdisk /dev/sdb -R /dev/sda

I intended to copy GPT of the failing disc, sda, to the new disc, sdb. Just the GPT. As you see above, I got them mixed up. This command copies just the GPT isn't that correct?

Regards,
RDL
Glassmenagerie
Posts: 4
Joined: 17 Apr 2023, 20:47

Re: GPT Overwritten

#4 Post by Glassmenagerie »

Would that copy command above also overwrite the secondary GPT at the end of the disc?

RDL
User avatar
cgrenier
Site Admin
Posts: 5441
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: GPT Overwritten

#5 Post by cgrenier »

Yes, sgdisk has overwritten both the main GPT table and its backup.
As only the GPT tables has been overwritten, TestDisk 7.2-WIP should be able to rewrite a valid partition table.
Glassmenagerie
Posts: 4
Joined: 17 Apr 2023, 20:47

Re: GPT Overwritten

#6 Post by Glassmenagerie »

Great! I'll give it a try then.

RDL
Locked