Fact-checked by Grok 2 weeks ago

TestDisk

TestDisk is a free and open-source software utility designed primarily to recover lost partitions and make non-booting disks bootable again when affected by software faults, viruses, or human errors. It achieves this by fixing corrupted partition tables, recovering deleted partitions, and rebuilding or repairing boot sectors for filesystems such as FAT32, , and /ext3/ext4. Additionally, TestDisk supports undeleting files from FAT, , , and filesystems, as well as copying files directly from deleted partitions. The tool is compatible with a wide range of operating systems, including DOS, Windows, Linux, FreeBSD, NetBSD, OpenBSD, SunOS, and MacOS X, making it versatile for use across different environments. It supports numerous filesystems, such as APFS, FAT12/16/32, exFAT, NTFS, ext2/3/4, HFS+, ReiserFS, UFS, JFS, XFS, BTRFS, enabling recovery from various storage media like hard drives and memory cards. Developed by CGSecurity and released under the GNU General Public License version 2 or later, TestDisk's latest stable version as of early 2025 is 7.2, which was initially released in February 2024. It is often used alongside its companion tool, , for broader file recovery needs, and is suitable for both novice users seeking expert consultation and professionals performing onsite recoveries.

Overview

Description

TestDisk is a free and open-source utility designed to help users recover lost partitions and repair corrupted filesystems on storage devices. It addresses issues such as non-booting disks caused by software malfunctions, viruses, or accidental user errors, and supports undeleting files from various filesystems. Licensed under the , TestDisk is distributed at no cost and allows modification and redistribution under its terms. The software is developed and maintained by Christophe Grenier through CGSecurity, with the latest stable release being version 7.2, issued on February 22, 2024. The tool operates via a (CLI) featuring text-based menus, making it accessible without a native , though it can function within terminal environments that support GUIs. This design emphasizes efficiency for both novice and expert users in diagnosing and fixing disk structures. TestDisk is frequently bundled with its companion program, , which specializes in signature-based to recover individual files independently of the filesystem; in contrast, TestDisk targets and filesystem-level recovery operations.

Development history

TestDisk was initiated in 1998 by Christophe Grenier as a -based repair designed to address common disk errors such as corrupted tables and non-booting disks. In the early 2000s, the was expanded to support cross-platform use, including ports to and Windows, broadening its accessibility beyond environments. In April 2002, Grenier added as a companion for , enabling recovery of individual files independently of the filesystem structure. Key milestones in TestDisk's evolution include the release of version 6.0 in 2005, which introduced advanced support for boot sector recovery and undeletion. Version 7.0, released on April 18, 2015, provided better support for and filesystems, along with various bug fixes and security improvements. Most recently, version 7.2 in February 2024 emphasized bug fixes, performance optimizations, improved handling of filesystems including enhanced support, and added APFS detection. TestDisk remains a solo project maintained by Grenier, who handles core and packaging. Contributions from the are facilitated through the repository hosted at cgsecurity.org, while binary downloads are distributed via . The project operates without major corporate backing, relying instead on donations and Grenier's longstanding expertise in . As of November 2025, a work-in-progress version 7.3 is available for testing.

Core Features

Partition recovery

TestDisk provides robust recovery capabilities by analyzing and reconstructing damaged or lost tables on devices. It employs scanning algorithms to detect structures, including copies, enabling the restoration of access to data without overwriting existing content. This process is particularly effective for disks where the underlying data remains intact, allowing users to recover entire s that have been deleted or corrupted. The tool scans disk structures by examining key areas such as the (MBR), (GPT), and extended partitions within the PC/Intel partitioning scheme. It locates backup partition tables or header signatures using quick and deeper search modes, which systematically probe the disk for valid partition entries based on size, type, and filesystem indicators. TestDisk supports recovery from corrupted MBRs, GPTs, and extended partitions, as well as other schemes like Apple partition maps and Sun slices. By analyzing disk geometry—such as cylinder-head-sector (CHS) or logical block addressing (LBA)—it identifies discrepancies and proposes corrections to align the partition layout with the actual data distribution. The recovery process follows a structured sequence of steps to ensure accuracy and minimize risks. Users begin by selecting the target disk and table type, then initiate an that performs a quick search for existing partitions. If partitions are missing, a deeper search extends the scan across the entire disk to locate lost ones, often using backup data like secondary headers or extended partition chains. TestDisk lists detected partitions, allowing users to verify them by inspecting filesystem contents (e.g., via the 'p' command to list files). Once validated, the updated table is written back to the disk, overwriting only the corrupted table without affecting partition data. This non-destructive approach preserves the original disk state until confirmation. TestDisk handles common failure scenarios effectively, including accidental partition deletion during repartitioning, overwrites by viruses that corrupt boot sectors, and errors from partitioning software like defragmentation tools that misalign structures. For instance, in cases of deleted FAT32 partitions following a defrag operation, TestDisk can manually add missing entries and rebuild the boot sector to restore access. Similarly, virus-induced damage to MBR or boot sectors is addressed by repairing or replacing them from backups. These recoveries succeed in scenarios where the partition data has not been overwritten, though outcomes depend on the extent of subsequent disk activity. A key feature is the ability to make non-booting disks bootable by rewriting boot sectors for supported filesystems, such as or FAT32, using backup sectors or reconstruction tools like RebuildBS, all without . This integrates with subsequent filesystem repairs if needed, but focuses primarily on partition-level restoration. Overall, TestDisk demonstrates high effectiveness for intact backup recoveries, as evidenced by its widespread use in data recovery examples.

Filesystem repair

TestDisk provides specialized tools for repairing corrupted filesystem structures within detected partitions, enabling access to without altering the underlying partition layout. These repairs target critical components such as sectors and tables, which are essential for mounting and reading filesystems. By focusing on logical corruptions rather than physical disk issues, TestDisk helps restore following events like improper shutdowns, power failures, or infections that disrupt filesystem integrity. For FAT12, FAT16, and FAT32 filesystems, TestDisk rebuilds damaged boot sectors by analyzing the filesystem geometry to recalculate parameters such as cluster size and root directory location, or by copying from a backup boot sector if one is present and valid. This process ensures the boot sector accurately reflects the filesystem's configuration, allowing operating systems to recognize and mount the volume. Additionally, TestDisk repairs FAT tables by comparing the primary and backup copies to reconstruct a coherent version, verifying and correcting chain links between clusters, marking bad clusters as unusable, and fixing inconsistencies in directory entries to prevent cross-linked files or lost allocation. These repairs are particularly effective against corruptions caused by abrupt interruptions, as they restore the linkage that maps file data across the disk. In volumes, TestDisk addresses damage by rewriting it using derived parameters or a viable , while also repairing the Master File Table (MFT) mirrors to synchronize the primary and secondary copies of this vital metadata structure. It further fixes issues in the $Boot file, which contains the data, ensuring consistency across 's self-describing elements. For ext2, ext3, and ext4 filesystems on systems, TestDisk locates and utilizes alternate s—stored at predefined offsets like block 32768 for a 4096-byte block size—to analyze and correct data, facilitating subsequent use of tools like for deeper inode repairs. Although TestDisk itself does not directly modify inodes, its recovery provides the foundation for restoring inode tables affected by similar corruption sources. To maintain data safety, TestDisk operates in a non-destructive mode by default, allowing users to preview repairs through a "List" function that displays the filesystem structure without committing changes, and prompting for backups of original sectors before any write operations. This cautious approach minimizes risks during the repair of common corruptions from power loss or malicious software, which often leave recoverable backups intact.

File recovery

TestDisk provides file recovery capabilities through metadata-based methods, focusing on undeleting files from intact or partially accessible filesystems and copying from deleted partitions without altering the original disk. This approach scans directory entries and file allocation tables to identify and extract deleted items, preserving original filenames and structures where possible, unlike signature-based tools. For undelete operations, TestDisk supports FAT12, FAT16, FAT32, , , and filesystems by examining directory entries marked as deleted and restoring access flags without rewriting the filesystem. On FAT and , users can navigate the filesystem tree to locate deleted files and directories, which appear in red, and copy them to a separate drive. For , it scans the Master File Table (MFT) entries to list and copy individual deleted files. On , recovery follows inode structures to retrieve files via directory listings. Success depends on the remaining intact and the not being overwritten by new allocations. TestDisk also enables copying files from deleted or inaccessible partitions across a broader range of filesystems, including , , , , , and , by virtually mounting the structure and browsing its contents. After analyzing the disk and identifying lost partitions, users press 'p' to list files within the partition, select items, and export them to another location, effectively salvaging without full recovery. This method relies on reconstructing the filesystem layout from backups or alternate superblocks, allowing access to the original directory hierarchy. The recovery process begins with selecting the affected disk in TestDisk, proceeding to the "Analyse" menu for quick or deeper searches to locate partitions, and then accessing the "Advanced" menu for undelete or listing files on found partitions. Users mark files or directories for recovery using keys like 'c' for copy or ':' for selection, specify a safe destination drive to avoid overwriting data, and quit to complete the operation. It is critical to recover to a different physical disk to prevent further . Limitations include the inability to recover filenames, folder structures, or fragmented files if is corrupted or clusters have been reused for new data, as TestDisk does not reconstruct missing allocation chains or perform content carving. Heavily overwritten files or those on unsupported filesystems cannot be recovered this way, and results are best for recently deleted items where the original data blocks remain allocated but flagged as free. For cases beyond metadata recovery, such as fragmented or heavily damaged filesystems, TestDisk integrates with , its companion tool, which handles signature-based extraction but without preserving original names or structures.

Technical Specifications

Supported file systems

TestDisk provides support for a wide range of file systems, enabling partition recovery, filesystem repair, and in some cases file undeletion or copying. Its capabilities vary by file system, with full recovery and repair options available for common ones like FAT and NTFS, while others receive limited or read-only analysis to minimize risks. The tool detects and can recover lost partitions across all supported file systems, but repair functions are targeted at specific structures such as boot sectors and metadata tables. The family, including FAT12, FAT16, and FAT32, receives full support for partition recovery, repair, table reconstruction, and file undeletion or copying in read-only mode. These file systems, commonly used in , Windows, and , benefit from TestDisk's ability to scan and restore the () to recover deleted files and fix corruption. , an extension for larger storage devices like flash drives and external HDDs, supports undeletion, file copying, and repair of its allocation table, though it lacks some advanced fixes available for . NTFS, the default file system for modern Windows installations, offers comprehensive support including full rebuilding, Master File Table (MFT) repair, and undelete operations with file listing and copying. TestDisk can scan the MFT to recover deleted files and directories, making it particularly effective for NTFS partition issues like overwritten s or partial corruption. For the ext family—ext2, ext3, and ext4, prevalent in environments—TestDisk enables recovery, inode scanning for lost files, repair, and read-only undelete with file copying. These features allow reconstruction of the backups and journal analysis to restore filesystem integrity. Apple's HFS, HFS+, and HFSX file systems, used in macOS, are supported for partition recovery and basic analysis, with capabilities to detect and rebuild the catalog file for limited repair. APFS, introduced in macOS High Sierra, receives read-only analysis support, allowing partition detection and basic inspection without write operations to avoid potential data corruption risks. Other file systems include ReiserFS versions 3.5, 3.6, and 4 with support for partition recovery and limited journal repair; XFS for superblock scanning and inode recovery; ZFS with basic partition detection but no advanced repair; BeFS for partition recovery; Btrfs with limited support for superblock and metadata scanning; JFS for basic recovery; and UFS/UFS2 for inode and superblock fixes. Additional supported systems encompass CramFS (read-only), GFS2, NSS, and specialized formats like XBox FATX and Wii WBFS for partition recovery. Encrypted or container systems like LUKS, LVM/LVM2, and Linux RAID (md 0.9/1.0/1.1/1.2, supporting RAID 1/4/5/6) are detectable for partition purposes, with Swap (v1/v2) recognized as a filesystem type. TestDisk also handles various partition table formats, including MBR () for legacy systems, GPT () for modern UEFI-based setups, BSD disklabel for BSD Unix variants, Mac partition map for Apple volumes, and Sun/Solaris i386 disklabel for systems. These allow the tool to analyze and rebuild the overall disk structure regardless of the underlying file systems.

Operating system compatibility

TestDisk is a cross-platform data recovery tool designed to operate on a variety of operating systems, enabling users to perform and file recovery tasks without dependency on a specific host environment. It originated as a DOS application but has evolved to support modern architectures through console-based execution. The tool runs natively on , including real-mode or within a -box, providing compatibility for legacy systems. For , it supports both 32-bit and 64-bit versions ( and later, including and 11) via console interface, with pre-compiled binaries available for direct execution. On , TestDisk is compatible with all major distributions, installable through package managers such as apt on /, dnf on , or pacman on , or via static Intel binaries that require no root privileges for basic use. macOS users can run it through , either by installing via Homebrew (brew install testdisk) or using official binaries, supporting versions from macOS 10.6 onward. Additionally, it operates on systems including , , , and /, leveraging source compilation or available ports for integration. TestDisk is frequently included in live environments for bootable recovery scenarios, such as SystemRescue (formerly SystemRescueCd) and Parted Magic, allowing operation from USB or CD without installing on the host system. Installation across platforms emphasizes portability: pre-compiled binaries are downloadable from the official CGSecurity website (cgsecurity.org), requiring no formal installer as the executable runs directly after extraction. For custom builds, users can compile from source using Autotools (via ./configure && make) after cloning the repository, or CMake for broader build flexibility; this approach supports adaptation to non-standard environments. Hardware compatibility focuses on storage interfaces, with support for drives, devices, USB , and SD cards, facilitating recovery from diverse media like hard disks and digital cameras. Direct disk access is essential, necessitating administrator or root privileges to read raw partitions and avoid filesystem restrictions. As of 2025, TestDisk maintains full compatibility with systems through its handling of EFI GPT partition tables, enabling recovery on modern boot configurations without issues. While no official ARM-specific binaries exist, the open-source nature allows compilation on ARM platforms like , with packages available in distributions such as . This cross-OS support complements its recovery capabilities, allowing consistent operation regardless of the host platform.

Applications and Use Cases

General data recovery

TestDisk is widely used in general for addressing logical issues on storage devices, such as recovering lost partitions following an operating system reinstallation that inadvertently overwrites the partition table. It also helps fix corruption caused by faulty software updates or , restoring access to non-booting disks without requiring advanced intervention. Another common application involves undeleting files accidentally removed from USB drives formatted with or filesystems, where TestDisk scans for recoverable entries in the filesystem structure. Best practices for using TestDisk in these scenarios emphasize preserving the original . Users should first create a using TestDisk's built-in Image Creation feature in the Advanced menu or the dd command to clone the affected drive onto a separate storage device, allowing all operations to occur on the copy. It is critical to avoid writing any new data to the affected disk during analysis and , as TestDisk operates in read-only mode by default for scanning but requires explicit user confirmation for any writes, such as partition table repairs. For beginners, starting with the Analyse option to gather disk information is recommended before proceeding to deeper scans. Despite its effectiveness, TestDisk has notable limitations in general data recovery contexts. It cannot address physical damage to storage media, such as bad sectors from failure, which requires specialized services. Similarly, it is ineffective for recovering data from encrypted volumes like those protected by without first decrypting them using the appropriate key, as TestDisk lacks native support for encrypted filesystem parsing. The tool's provides no , making it unsuitable for non-technical users and necessitating familiarity with disk structures and command navigation. TestDisk performs best on logical errors, such as table corruption or deleted entries, often achieving high rates for intact structures while success for individual files diminishes if filesystem has been overwritten. In professional workflows, it serves as an initial step to restore visibility before employing graphical tools like for file-level undeletion or EaseUS Data Recovery Wizard for further extraction.

Digital forensics

TestDisk plays a crucial role in by enabling investigators to recover and analyze disk structures without modifying the original . It supports the examination of seized storage devices, allowing for the identification of hidden or deleted partitions that may contain critical investigative , such as in cases involving data concealment. The tool's read-only analysis capabilities ensure that integrity is maintained throughout the process, aligning with forensic standards for chain-of-custody preservation. For evidence preservation, TestDisk employs non-destructive logging techniques, capturing disk geometry, partition tables, and filesystem into hex dumps or detailed reports without writing to the source media. This is achieved through read-only modes, such as using loopback devices (e.g., losetup -r) or mounting disk images in read-only format, which prevents inadvertent modifications like alterations that could occur from mounting the drive. Investigators can thus perform and on live or imaged evidence drives, avoiding the need for hardware write-blockers in many scenarios while countering potential challenges to evidence admissibility. In practical applications, TestDisk facilitates the recovery of deleted or hidden partitions on filesystems like and , verifies filesystem integrity during audits, and extracts data from compromised drives, such as those affected by . For instance, it can undelete files and directories from volumes, including alternate data streams () often used by to hide payloads, without altering the original structure. Its outputs, including files and hex views, are compatible with forensic suites like for further analysis or for reporting, making it valuable in and Incident Response (DFIR) workflows. TestDisk's advantages in forensics include its , open-source nature and high portability, allowing deployment on bootable media for field use without installation, ideal for onsite . It supports advanced features like ADS searches on , enhancing detection of steganographic or hidden data. In case examples, TestDisk has recovered partitions and files in infection scenarios, such as the Honeynet Project's Scan 15 challenge simulating real-world compromises. It has also been tested for accuracy in NIST's Digital Forensic Tool Testing (DFTT) benchmarks, successfully handling undelete and partition recovery tasks on standardized images.

References

  1. [1]
    Partition Recovery and File Undelete - CGSecurity
    Mar 9, 2024 · TestDisk is powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again.TestDisk Download · TestDisk Step By Step · TestDisk Livecd · TestDisk FAQ
  2. [2]
    TestDisk 7.2 Release - CGSecurity
    Feb 2, 2024 · TestDisk is a powerful free data recovery program! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again.
  3. [3]
    TestDisk Download - CGSecurity
    Mar 5, 2025 · Download TestDisk & PhotoRec. TestDisk is a free and open source data recovery software tool designed to recover lost partition and unerase ...下载 TestDisk · TestDisk Livecd · Testdisk 7.2 documentation · TestDisk 7.2 Release
  4. [4]
    1. Presentation — testdisk 7.2 documentation - CGSecurity
    TestDisk is a free, open-source data recovery utility that can recover deleted partitions, rebuild partition tables, and rewrite the MBR.
  5. [5]
    CGSecurity - Data recovery: TestDisk & PhotoRec
    Feb 22, 2024 · TestDisk and PhotoRec are free and open source data recovery software tools designed to recover lost partition, unerase deleted files, ...TestDisk Download · TestDisk · PhotoRec · CmosPwd
  6. [6]
    TestDisk Team - CGSecurity
    May 22, 2019 · Christophe Grenier​​ He started the project in 1998 and is still the main developer. He is also responsible for the packaging of TestDisk & ...Missing: history | Show results with:history
  7. [7]
    Rescuing Lost Files with TestDisk and PhotoRec - » Linux Magazine
    Christophe Grenier initially wrote TestDisk as a partition repair tool under DOS, which explains the DOS-like command-line syntax, with /flag options instead ...Missing: ported | Show results with:ported
  8. [8]
    File: ChangeLog - Debian Sources
    2011-02-07 - Christophe Grenier Minimal support to list and copy files from exFAT for TestDisk. ... ) 2008-03-24 - Christophe Grenier Reports OS version and ...
  9. [9]
    TestDisk 7.0 Release - CGSecurity
    May 22, 2019 · TestDisk is a powerful free data recovery program! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again.
  10. [10]
  11. [11]
    TestDisk & PhotoRec download | SourceForge.net
    Rating 5.0 (2) · FreeOct 30, 2021 · Download TestDisk & PhotoRec for free. Disk recovery utility. TestDisk checks the partition and boot sectors of your disks.
  12. [12]
    TestDisk Review: Scan Results, Pros, Cons & Our Verdict
    Rating 5.0 (1) Dec 6, 2024 · TestDisk comes from a respected and trustworthy developer, Christophe Grenier, who started the project in 1998 and remains the primary developer ...
  13. [13]
    [PDF] TestDisk Documentation - CGSecurity
    Sep 26, 2025 · TestDisk & PhotoRec are free and open-source data recovery utilities. They can be downloaded from https://www. cgsecurity.org/.
  14. [14]
    TestDisk Step By Step - CGSecurity
    Jan 20, 2016 · TestDisk recovers missing partitions and repairs corrupted ones, such as a damaged boot sector and deleted logical partition, using steps like ...Missing: official | Show results with:official
  15. [15]
    Data Recovery Examples
    ### Summary of Partition Recovery Scenarios Using TestDisk
  16. [16]
    8. Recovering deleted files using TestDisk - CGSecurity
    When a file is deleted, the data remains on the disk. Unless new data has overwritten your lost file, TestDisk can usually recover it.Missing: mechanism | Show results with:mechanism
  17. [17]
    8.1. TestDisk: undelete file for FAT, exFAT, ext2 — testdisk 7.2 documentation
    ### Summary of FAT Undelete Process and Limitations (TestDisk Documentation)
  18. [18]
    8.2. TestDisk: undelete file for NTFS - CGSecurity
    Recovering deleted files using TestDisk · 8.1. TestDisk: undelete file for FAT, exFAT, ext2; 8.2. TestDisk: undelete file for NTFS. 8.2.1. Start TestDisk; 8.2.2 ...Missing: accuracy | Show results with:accuracy
  19. [19]
  20. [20]
    2. Installation — testdisk 7.2 documentation - CGSecurity
    TestDisk and QPhotoRec are available in the EPEL repository for CentOS. As root, yum install epel-release yum install testdisk qphotorec
  21. [21]
    TestDisk Data Recovery Review: Pros & Cons - Disk Drill
    May 7, 2025 · You'll see two versions on the official site: the stable release TestDisk 7.2 (Feb 22, 2024) and a 7.3-WIP beta (Work In Progress). While the ...
  22. [22]
  23. [23]
    3.3. Compilation — testdisk 7.2 documentation - CGSecurity
    To compile from source, run `tar xjf testdisk-7.2.tar.bz2`, then `cd testdisk-7.2`, `./configure && make`. From git, use `git clone https://git.cgsecurity.org/ ...
  24. [24]
    TestDisk - Wikipedia
    TestDisk is a free and open-source data recovery utility that helps users recover lost partitions or repair corrupted filesystems.<|control11|><|separator|>
  25. [25]
    testdisk (aarch64) | Packages - Arch Linux ARM
    Architecture: aarch64. Repository: extra. Description: Checks and undeletes partitions + PhotoRec, signature based recovery tool.
  26. [26]
    Recover partitions and files with TestDisk - Red Hat
    Jul 8, 2019 · TestDisk 7.0, Data Recovery Utility, April 2015 Disk /dev/sdb - 1939 MB / 1850 MiB - CHS 1018 60 62 Partition Start End Size in sectors >D ...
  27. [27]
    Image Creation - CGSecurity
    Jan 29, 2016 · In example, TestDisk Advanced menu can be used to list and copy the files from FAT, NTFS and ext2/ext3/ext4 partitions or PhotoRec to carve data ...
  28. [28]
    BitLocker Partition Recovery with TestDisk
    Sep 13, 2024 · This article provides a tutorial to use TestDisk to recover corrupted, damaged, inaccessible, lost or deleted BitLocker partition as well as ...
  29. [29]
    TestDisk 7 Review: Features, Performance, Pros & Cons - iBoysoft
    Aug 5, 2025 · TestDisk is more of a partition table repair tool than a data recovery ... High success rate. The advanced disk scanning algorithms ...
  30. [30]
  31. [31]
    TestDisk and PhotoRec in various digital forensics testcase
    May 22, 2019 · TestDisk has found all the deleted files but fragmented files aren't recovered correctly.Missing: mechanism | Show results with:mechanism
  32. [32]
    18.4. Forensics: write blockers — testdisk 7.2 documentation
    Their use is to prevent inadvertent modification of evidence. Protecting an evidence drive from writes during investigation is also important to counter ...
  33. [33]
    18.2. DFTT: Undelete files from a NTFS filesystem - CGSecurity
    TestDisk lists all lost files successfully. The alternate data stream is listed as ./mult1.dat:ADS , alternate streams are not listed in Windows Explorer, and ...
  34. [34]
    Ambiguous file system partitions - ScienceDirect.com
    Some of the used tools (TestDisk, Autopsy and X-Ways Forensics) have integrated file carving functions. By using them all of the created test files can be ...
  35. [35]