Restore GPT Partition Table After Wrong Format

I accidentally formatted the wrong drive and may have damaged or erased the GPT partition table. The disk still shows up, but my partitions and files are missing. I need help figuring out the safest way to restore the GPT partition table and recover the data without making things worse.

If a disk suddenly shows up as “RAW,” “Unallocated,” or “GPT Protective Partition,” don’t assume the data is already gone. It looks bad, but with GPT drives there may still be usable partition info left, including the backup GPT table stored near the end of the disk.

The worst move is trying random fixes in Windows. Don’t initialize the drive, format it, make a new volume, or run anything that rewrites the partition table. Every write to that disk can lower your chances of getting the files back cleanly.

The safer approach is to get the data off first, then worry about fixing the partition layout later.

Start by making a full sector-by-sector clone or image of the drive. That gives you something to work on without risking the original disk. Tools like dd can do this, but ddrescue is usually the better pick if the drive might have bad sectors, since it handles read errors more carefully.

Once you have an image, run your scans against that copy if possible. If a recovery tool guesses wrong or something goes sideways, the original drive is still in the same condition as before.

For most users, file recovery should come before partition repair. Disk Drill is a reasonable option because it can scan for lost partitions, damaged file systems, and file signatures without making you manually edit GPT entries. The scan itself is read-only, so you can see what it finds before deciding what to recover.

After the scan finishes, use the preview feature if it’s available. If the files look correct, save them to a different drive with enough free space. Do not recover anything back onto the problem disk, since that can overwrite data you still need.

Only after the important files are copied somewhere safe would I start thinking about repairing the partition table.

TestDisk is one of the better tools for that job. It can search for lost partitions and rebuild the partition table, but you need to be careful when it asks to write changes. Don’t write anything unless the partition it found clearly matches the old layout.

For GPT-specific issues, gdisk can also help. Since GPT stores a secondary header at the end of the disk, gdisk can sometimes use that backup to rebuild the damaged main GPT header.

One more thing: if Windows calls it a “GPT Protective Partition,” don’t jump straight to Diskpart and run clean. That command wipes partition information and can make the recovery harder.

That warning can show up for a few reasons, including an older OS, a compatibility problem, or even a USB dock/enclosure that isn’t reading the drive properly. Before doing anything destructive, scan it with recovery software and see if the files are still visible. In a lot of cases, the data is still sitting there even though Windows can’t mount the volume normally.

7 Likes

Check how the drive is connected before you start repairing anything. If this is an external drive, try to read it through the same enclosure or adapter it was originally used with, and avoid swapping USB docks at random. Some enclosures translate sector size differently, and a disk that looks like a broken GPT in one dock can look normal or at least more sensible in another. That does not mean the partition table is fine, but it can keep you from “fixing” the wrong problem.

I agree with the clone-first advice, but I’d be careful about jumping straight to rebuilding the GPT just because a tool offers to. A formatted partition and a damaged partition table are different problems. If you formatted the wrong volume, the GPT entries may still be present while the file system metadata is what got replaced. In that case, writing a “repaired” partition table may not bring files back and could make later recovery more confusing.

A decent order would be: confirm the physical disk and size are what you expect, image it, scan the image, recover important files to another drive, then think about TestDisk or gdisk. Disk Drill or similar tools are fine for the scan-and-preview stage, especially if you don’t want to manually pick start and end sectors. If you need a visual example of the general process, this walkthrough may help: recovering data from a lost GPT partition. Just don’t copy every click blindly, since the correct choice depends on what your disk actually shows.

Do not run chkdsk on it just because Windows suggests it. That can “fix” the file system by throwing away damaged metadata, which is the opposite of what you want if you are still trying to recover files.

I’d treat “restore the GPT” as a later repair step, not the main goal. The backup GPT at the end of the disk can help if only the primary GPT header or entries got damaged, but it won’t undo a format that overwrote file system structures inside the partition. That’s where people get burned: the partition comes back, Windows mounts it, and then they start poking around on a damaged volume.

A small safety step that often gets skipped: if you’re on Windows, take the disk offline in Disk Management or use a write blocker/read-only adapter if you have one. At minimum, don’t let Windows assign a drive letter and start indexing, checking, or creating hidden folders on it. Then image the disk and scan the image. Disk Drill is fine for a first pass if you want previews and don’t want to think in sectors, but don’t judge success by “it found a partition.” Judge it by whether the actual files preview correctly and recover to a different drive.

If you later use TestDisk or gdisk, write changes only when the found partition boundaries make sense for the old layout. Same size, same order, same file system, believable starting sector. If the tool shows several possible old partitions and you’re guessing between them, stop and recover files first. Guessing wrong on the partition table can turn a recoverable mess into a more annoying one.