How to restore a lost SSD/HDD partition with its folders structure using TestDisk on Windows 117 min read

Background

As you know, I use a dual-boot setup with Windows and Ubuntu. While I spend 95% of my time on Ubuntu Linux for development and daily tasks, I occasionally need Windows for specific purposes. This setup offers great flexibility but often comes with challenges, especially when mounting other partitions on my SSD in Ubuntu or accessing an external HDD.

This morning, I encountered an issue mounting a partition (D), where I store personal and work-related files. Initially, I suspected the problem was caused by my recent use of Windows where turning off Windows and booting directly into Ubuntu, causes this problem. Therefore, I rebooted into Windows, restarted, and then tried Ubuntu again, but that didn’t work!

At this point, I decided to try the infamous and powerful fdisk (yes, I know—messing with that is always a risk!). Long story short, I lost everything. When I booted back into Windows, all I could see was an empty and inaccessible partition (D) where its file system was being converted to RAW.

Screenshot of the lost partition D using the Disk Management tool in Windows 11

This situation nearly gave me a heart attack—it meant I had potentially lost all the data on that partition. However, I tried to stay calm and focus on finding a solution. The silver lining was that I hadn’t formatted the partition or copied new files onto it, which meant the chances of recovering the data were relatively high (at least based on my experience). Still, I couldn’t shake the anxiety.

I began researching online and came across a few promising programs, like Wondershare Recoverit and MiniTool Partition Wizard. Both are highly effective tools, but they come with a catch—they’re paid software. Additionally, Wondershare Recoverit, for example, doesn’t preserve the original folder structure during the recovery process. For me, this was a deal-breaker. Honestly, I would almost prefer to consider everything lost than to have all my files—images, PDFs, Python/JS/PHP files, etc.—dumped into a single folder without any organization.

Anyway, I kept searching and suddenly remembered that I had faced a similar problem a couple of years ago. Back then, I was dealing with a corrupted SD card that contained important video files. I used both PhotoRec and TestDisk to recover the data. PhotoRec worked wonders and helped me restore everything—it was truly a blessing.

TestDisk ftw

TestDisk is an amazing open-source software (command prompt) that never fails anybody in need when it comes to restoring corrupted and lost partitions and files. The program can be downloaded here. There is no need to install it, just download it and you are good to go.

The only downside (I don’t consider it a downside myself) is that it does not have a GUI, so non-experienced CMD users or people who are afraid of black screens may consider it too difficult or scary to use 😛

For this post, I took screenshots of every step of the process. I will just insert them and provide some very basic explanations since they speak for themselves.

1. Download the Windows version of TestDisk here and extract the content.

2. Run the program testdisk_win.exe

3. Choose whether you want to create a log file or not

4. Select the target disk (SSD or HDD) where the partition is lost and to be restored.

5. Since the file system in my case was RAW, I would choose the partition table type to be [Intel]

6. Choose Analyse to search for lost files/partitions.

7. Choose “Quick Search” to start the process.

8. The “Quick Search” process has started and in this screenshot, it reached 37%.

9. The result of the “Quick Search” as you see, does not include our lost partition. Therefore, press “Q” to go back.

10. Once you go back, choose “Deeper Search” (self-explanatory).

11. The process of “Deeper Search” starts.

12. Once the “Deeper Search” is done (it highly depends on your disk size), you choose the lost partition. In my case, the entry is highlighted in green. As you notice at the end of the screenshot it says: “NTFS found using backup sector, blocksize=4096, 220 GB / 205 GiB”. This was indeed my lost partition. Press P to list files of this partition.

13. Select all files and directories in the partition you want to restore by pressing “:” . Then press “C” to copy them.

14. Choose the destination where the TestDisk must store the recovered files/folders. Once chosen, press “C” to confirm the choice and start the recovery process.

14. The next screen must look as follows:

15. Finally, when TestDisk completes the recovery process, the screen looks as follows:

Feel free to contact me if you have any questions or need help with restoring lost files/partitions. Please don’t forget to donate to TestDisk

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.