A lost partition table can make a whole drive look empty in seconds. The computer may report the disk as unallocated, unknown, or not initialized, even though the drive held years of files the day before. It feels like everything vanished, but in many cases only the map to the data is gone, not the data itself.
Rebuilding that map is a delicate job. Done carefully, the drive can return to normal with its partitions and files intact. Done in a rush, one wrong click can make recovery far harder.
This guide explains how a partition table works, how to rebuild it safely with TestDisk, and how to avoid touching the data area while you do it.
Quick Answer
Stop using the drive, never initialize or format it, and work on a sector-by-sector clone or image if the drive matters. Run TestDisk in analyse mode, which only reads the drive, let it find the old partition boundaries, preview files to confirm each partition, and then use the single Write command, which rewrites only the small partition table area at the start of the disk. TestDisk does not move, copy, or rewrite the data area itself, so a correct write restores access without touching your files.
What the Partition Table Actually Is
Think of a drive as a warehouse and the partition table as its floor plan. The plan lists where each section starts and ends. The goods are your files, in the larger data area.
On older MBR disks, the partition table sits inside the first sector of the drive, a tiny 512-byte area. On modern GPT disks, the table sits near the start with a backup copy near the end. Either way, the table is tiny compared with the terabytes of data that follow it.
Viruses, power loss, a failed resize, or removing a USB drive at the wrong moment can corrupt this small area. Operating systems then treat the disk as blank, which is why Windows may suggest initializing it. That suggestion must always be refused.
Critical warning: If Windows, macOS, or any tool asks to initialize, format, or create a new volume on the drive, cancel it. Initializing writes a new empty table and can overwrite the backup information recovery tools rely on.
The Golden Rule: Clone First When You Can
The safest recovery is one performed on a copy. A sector-by-sector clone or image copies every byte of the drive, including the damaged table and all data, to another drive of equal or larger size.
- Cloning protects you because a mistake on the clone leaves the original unchanged.
- Cloning is essential if the drive clicks, disconnects, reads very slowly, or has reported SMART warnings.
- Use a tool designed for failing drives, which skips bad areas first and returns to them later.
If you have never done this before, our detailed guide on how to clone a failing drive with ddrescue step by step shows the full process. If the drive is healthy, many people recover in place with TestDisk, but the clone-first route is always safer.
Understanding TestDisk: Recovery Mode vs Write Mode
Most fear around TestDisk comes from not knowing when it changes the disk. The TestDisk step-by-step guide on the CGSecurity wiki makes the distinction clear, and it is the key idea in this whole article.
Recovery and analyse mode (read-only)
From the moment TestDisk starts until you confirm a write, it only reads. Scanning, listing partitions, and pressing P to preview files are all read-only actions. You can run a full scan, inspect every result, close the program, and the drive will be exactly as it was. Use this mode freely to investigate.
Write mode (the one real change)
Write mode happens only when you select Write on the partition list screen and confirm with Y. At that moment TestDisk writes the new partition table to the small table area of the disk, and, on GPT disks, can also repair the backup table. It does not format partitions, does not create file systems, and does not copy or move the contents of the data area. If the boundaries you approved are correct, the operating system can suddenly see the partitions again because the map is fixed.
Understanding this split means you never need to rush. Do all your checking in read-only mode, and treat the Write confirmation as the single serious decision.
Step-by-Step: Rebuild the Partition Table
Step 1: Prepare
- Stop using the affected drive. If it is an external drive, leave it connected but do not open it in Explorer or Finder.
- Prepare a second computer or boot from a USB recovery environment if the affected drive is your system disk.
- Make the clone or image now if you are following the safest route, and attach the clone for the steps below.
- Write down everything you remember about the old layout: how many partitions, rough sizes, order, and file systems such as NTFS, exFAT, or ext4.
Step 2: Scan with TestDisk
- Run TestDisk as administrator or with sudo, and choose to create a log if you want a record.
- Select the correct physical drive by model and capacity. Double-check, because the list may show several similar drives.
- Accept the detected table type, Intel for MBR or EFI GPT for GPT, unless you know it is wrong.
- Choose Analyse, then Quick Search, and let the scan complete.
- If partitions are missing or shown with wrong sizes, run Deeper Search and wait for it to finish.
Step 3: Verify every partition before writing
- Highlight each found partition in turn and press P to list its files.
- Confirm the folder structure looks like your data, not random names or an empty listing.
- Check for overlaps and gaps. Partitions should sit end to end without covering each other.
- Compare sizes and order with your written notes from Step 1.
- For GPT disks, if TestDisk reports a damaged main table but a valid backup, it may offer to repair using the backup. This is often the cleanest fix of all.
Step 4: Write the rebuilt table
- When every partition is verified, press Enter to proceed to the write screen.
- Select Write, read the summary one last time, and confirm.
- Quit TestDisk completely.
- Restart the computer, or safely disconnect and reconnect an external drive, so the operating system reads the new table fresh.
- Open each partition, test several files of different types, and immediately copy the most valuable data to another drive.
After the Rebuild: Check the File Systems
A rebuilt table restores access, but the file system inside a partition may still have minor damage from whatever caused the original problem.
- First, copy important files off the drive before running any repair tool.
- Only after copying, run a read-only check, such as chkdsk without the /f switch on Windows, to see if errors are reported.
- Check SMART health with a free tool. A failing drive should be replaced, not trusted.
When Not to Attempt This Yourself
Stop and contact a professional if the drive makes clicking or beeping sounds, if it was dropped, or if it holds the only copy of data you cannot afford to lose. Software attempts on a physically dying drive can close the last window for recovery.
Common Mistakes to Avoid
- Initializing the disk when prompted. This writes a fresh empty table and is the single most damaging click in this situation.
- Creating a new partition “just to test”. A new volume writes file system structures into the data area and can overwrite lost files.
- Running a format or a quick format. Even a quick format damages the file system records that make recovery clean.
- Skipping file previews. Without pressing P and seeing real files, you may write wrong boundaries that point at empty space.
- Selecting the wrong physical drive. Writing a table to a healthy drive that held different partitions creates a new problem. Verify model and size twice.
- Continuing to use a failing drive after recovery. Recover the data, then replace the drive.
Conclusion
Rebuilding a lost partition table is really about restoring a tiny map, not rebuilding your data. Stop all writes, refuse any offer to initialize or format, clone the drive when you can, and let TestDisk search in its read-only analyse mode. Preview every partition’s files, confirm the layout matches what you remember, and only then use the one Write command that updates the table area alone. Followed patiently, this process brings whole drives back to life without touching the data you care about.
Frequently Asked Questions
Does rebuilding the partition table delete or move my files?
No. Writing a partition table changes only the small table area at the start of the disk, and on GPT disks the backup at the end. It does not format partitions or move the data area. Your files stay exactly where they were, which is why a correct table instantly makes them visible again.
What is the difference between MBR and GPT recovery?
MBR keeps one small table in the first sector, while GPT keeps a main table near the start and a backup near the end of the drive. GPT is often easier to save because TestDisk can rebuild the main table from the backup copy if the backup survived.
Windows says the disk is “not initialized”. Should I click initialize?
Never, if the disk held data you want. Initializing writes a new blank table and may destroy the clues and backup structures that recovery tools use. Cancel the dialog, leave the drive alone, and start the TestDisk process instead.
Can I rebuild the table on the drive my computer boots from?
Not while running from that same drive. Boot from a USB recovery environment or attach the drive to another computer as a secondary disk. This also guarantees nothing writes to the drive during recovery.
What if TestDisk finds partitions but the file preview is empty?
An empty or garbled preview usually means those boundaries are wrong, the file system is damaged, or the result is a false match from an older layout. Do not write that entry. Try Deeper Search, check other results, and consider file-level recovery on a clone instead.


Leave a Reply