What this utility is for
TestDisk is a free command-line program from CGSecurity designed to restore access to damaged or inaccessible drive partitions and to retrieve lost files. It’s intended for rescuing data when partitions have been accidentally removed, corrupted, or made unusable by malware or disk errors.
Devices and file systems it handles
- NTFS — commonly used on Windows systems
- APFS — Apple’s modern file system
- FAT — older removable-media and legacy partitions
- ext variants — typical on Linux installations
It works with both internal and external storage media, including HDDs, SSDs, USB flash drives, and memory cards.
Common situations where it helps
- Recovering partitions that won’t mount or appear in the OS
- Restoring bootable drives so the system can start again
- Retrieving individual files that were deleted but not yet overwritten
If you’re dealing with a non-booting installer, a corrupted system disk, or accidental partition loss, TestDisk is a practical option.
How to operate TestDisk (basic workflow)
- Launch the program from a terminal on the machine where the affected drive is attached.
- Choose Create (or the equivalent option) to start a new session.
- Select the physical disk you want TestDisk to inspect from the displayed list.
- Specify the partition table type that matches the target system (Windows, macOS, Linux, etc.).
- Run the analysis/scan and wait for it to complete.
- Review the scan results, pick the partition(s) you want to restore, and proceed with recovery or rewrite operations.
- To recover individual files, open the Advanced/File system utilities menu for the selected disk and use the Undelete (or similar) command to list and save recoverable files.
Despite being terminal-based, the sequence is menu-driven and becomes straightforward after a few tries.
Repairing boot issues vs recovering files
- For boot-related problems: use the partition-recovery and partition-table writing options to restore bootable partitions and fix boot sectors.
- For lost files: use the advanced file-recovery/undelete tools to browse and extract specific files without rewriting the partition table.
Choose the appropriate path depending on whether you need the drive to boot or just want to extract data.
Important considerations
- There is no graphical interface — everything is done via text menus in a command shell.
- Avoid writing to the affected disk from the host OS while performing recovery; work on a copy or mount the drive read-only when possible.
- Success depends on how much of the disk has been overwritten; early action improves the chance of full recovery.
If you’re comfortable using a terminal, TestDisk is a powerful and free option for rescuing partitions and files. Give it a try on non-critical hardware first to learn the menus and options.
Technical
- Windows
- Mac
- Free