How to Recover a GPT Partition
This guide explains how to recover a damaged or missing GPT partition on Windows, macOS, or Linux. GPT (GUID Partition Table) is the modern partitioning scheme used by most drives, and when it gets corrupted you may see the disk as unallocated or fail to boot. You’ll learn how to rebuild the partition table, restore lost partitions, and fix common errors—without needing specialized recovery software.
What You’ll Need
- A computer with the affected drive connected (internal or external).
- Administrator or root access to run disk tools.
- A backup of any critical data (if the drive is still accessible).
- For Windows: a Windows installation USB or recovery drive (if the system won’t boot).
- For Linux: a live USB with gdisk or parted installed (if the system won’t boot).
- For macOS: a recovery mode boot (Command+R at startup).
Step-by-Step
- Identify the problem drive. Open Disk Management (Windows), Disk Utility (macOS), or run
lsblk(Linux) to see the disk status. If the drive shows as “Unallocated” or “Uninitialized,” the GPT is likely damaged. - Do not format or initialize the drive. Any write operation can overwrite the very data you need to recover. Stop using the drive immediately.
- Make a byte-for-byte backup (optional but recommended). Use
dd(Linux/macOS) or a tool like Clonezilla to image the entire drive to another storage device. This protects against mistakes during recovery. - Open a command prompt with admin rights. On Windows, right-click Start and select “Command Prompt (Admin)” or “Windows PowerShell (Admin).” On Linux, use
sudo. On macOS, open Terminal from Recovery. - Rebuild the GPT using gdisk (Linux/macOS) or TestDisk (all platforms). For gdisk: run
sudo gdisk /dev/sdX(replace sdX with your drive). At the prompt, typewto write a new GPT if the backup GPT is intact, or userfor recovery options. For TestDisk: runtestdisk /dev/sdX, select “Intel” partition type, then “Analyse” and “Quick Search” to find lost partitions. - For Windows, use TestDisk or a third-party tool. Download TestDisk, run it as admin, select the disk, choose “Intel” partition type, then “Analyse” and “Quick Search.” If partitions are found, select them and choose “Write” to restore the GPT.
- If the GPT backup is intact, use the backup to restore. In gdisk, type
xfor expert mode, thenpto print the backup GPT, andwto write it back. This often repairs a corrupted primary GPT. - For boot issues, repair the EFI System Partition (ESP). If the GPT is fixed but the system still won’t boot, the ESP may be missing or damaged. On Windows, use
bootrec /fixmbr,bootrec /fixboot, andbootrec /rebuildbcdfrom a recovery command prompt. On Linux, reinstall GRUB withgrub-install /dev/sdX. - Verify the recovery. After writing the new GPT, check that all partitions appear with correct sizes and file systems. On Windows, open Disk Management; on Linux run
fdisk -l /dev/sdXorgdisk -l /dev/sdX. - Mount the partitions and test access. If data appears intact, copy critical files to another drive before relying on the recovered partition.
Common Mistakes
- Formatting the drive – This creates a new partition table and destroys the old one, making recovery nearly impossible.
- Using the wrong disk identifier – Accidentally targeting the wrong drive can wipe your system or another data drive. Double-check the disk number and size.
- Ignoring backup GPT – GPT stores a backup at the end of the disk; using it can restore a corrupt primary table.
- Writing changes without understanding – In tools like TestDisk, pressing “Write” without verifying the partition list can overwrite the wrong sectors.
- Not backing up first – A simple mistake during recovery can permanently lose data.
Tips
- Use the backup GPT first – If the primary GPT is corrupt, the backup is often intact. In gdisk, type
xthenbto use the backup. - TestDisk is powerful but safe – It only writes when you explicitly choose “Write,” and it shows a preview of found partitions.
- Work on a copy – If possible, clone the drive first and practice recovery on the clone.
- Check the disk’s health – A failing drive can cause repeated GPT corruption. Run
smartctl(Linux) or use CrystalDiskInfo (Windows) to check SMART status. - Keep a Windows recovery USB – It includes command-line tools like
diskpartandbootrecthat are essential for boot recovery.
Troubleshooting
If the drive still shows as unallocated after recovery: The GPT may be beyond repair, or the partition table was completely overwritten. Try a deeper scan with TestDisk (choose “Deeper Search” after Quick Search). If that fails, use PhotoRec (from the TestDisk family) to recover files by signature, but note that filenames and folder structure will be lost.
If the system won’t boot after GPT repair: The EFI System Partition may be missing or not marked as bootable. In gdisk, ensure the ESP has type code EF00 and is set as the first partition. Then reinstall the bootloader as described in step 8.
If you see “GPT PMBR size mismatch” or similar errors: This means the protective MBR and GPT disagree. Use gdisk and type w to write a correct protective MBR. This is safe if the GPT is valid.
If the drive is not detected at all: Check physical connections, try a different port or enclosure, and check if the drive appears in BIOS/UEFI. If not, the issue may be hardware, not partition table.
If TestDisk finds partitions but they are the wrong size: Manually edit the partition start and end sectors using the P (print) and L (log) commands. Use the values from a working system if you have a backup of the partition table.
Frequently Asked Questions
Can I recover a GPT partition without software?
Yes, if the backup GPT is intact, you can use built-in tools like diskpart (Windows) or gdisk (Linux) to restore it. However, for most cases, free tools like TestDisk are easier and more reliable.
Will recovering a GPT partition delete my data?
No, the recovery process only rebuilds the partition table, not the data itself. As long as you don’t format or write to the drive, your files should remain intact.
What’s the difference between MBR and GPT recovery?
GPT stores multiple copies of the partition table and uses CRC checks, making it more robust. Recovery often involves using the backup GPT or scanning for lost partitions. MBR recovery is similar but has only one table and no backup.
How long does a GPT recovery take?
It depends on the drive size and the method. Using the backup GPT takes seconds. A deep scan with TestDisk can take hours for large drives, but a quick scan usually finishes in minutes.
Can I recover a GPT partition on an external drive?
Yes, the same steps apply. Just make sure you select the correct disk in the tools, as external drives are often listed with different device names.
What if my drive is encrypted (BitLocker, FileVault)?
Recovering the partition table will restore the encrypted partition, but you’ll still need the encryption key or password to access the data. The recovery process itself doesn’t decrypt anything.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.