Linux command
testdisk 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Start testdisk
sudo testdisk
Analyze a specific disk
sudo testdisk [/dev/sdX]
Analyze a disk image
testdisk [path/to/image.dd]
Create a log file
sudo testdisk /log [/dev/sdX]
List partitions
sudo testdisk /list [/dev/sdX]
Dump raw sectors
sudo testdisk /dump [/dev/sdX]
Show the version
testdisk /version
说明
TestDisk is a powerful open-source data recovery utility designed to recover lost partitions and repair boot sectors. It can restore partition tables, recover deleted partitions, rebuild boot sectors for FAT and NTFS, and fix corrupted file systems. TestDisk supports a wide range of file systems including FAT12/FAT16/FAT32, NTFS, exFAT, ext2/ext3/ext4, HFS/HFS+, JFS, ReiserFS, XFS, and many others. It works with various partition table types including DOS/MBR, GPT, Mac, and BSD disklabels. The utility operates in an ncurses-based interactive menu, guiding users through the recovery process. TestDisk also includes a file recovery feature accessible through its Advanced menu, allowing recovery of deleted files from supported file systems.
参数
- /log
- Append all operations and analysis results to testdisk.log in the current directory.
- /debug
- Enable debug mode with additional detailed output.
- /list
- Display partition information for the specified device or image and exit.
- /dump
- Dump raw sector contents into the log for post-mortem inspection.
- /version
- Print the TestDisk version and exit.
- device
- The disk device to analyze (e.g. /dev/sda, /dev/nvme0n1).
- image
- A disk image file to analyze instead of a physical device.
FAQ
What is the testdisk command used for?
TestDisk is a powerful open-source data recovery utility designed to recover lost partitions and repair boot sectors. It can restore partition tables, recover deleted partitions, rebuild boot sectors for FAT and NTFS, and fix corrupted file systems. TestDisk supports a wide range of file systems including FAT12/FAT16/FAT32, NTFS, exFAT, ext2/ext3/ext4, HFS/HFS+, JFS, ReiserFS, XFS, and many others. It works with various partition table types including DOS/MBR, GPT, Mac, and BSD disklabels. The utility operates in an ncurses-based interactive menu, guiding users through the recovery process. TestDisk also includes a file recovery feature accessible through its Advanced menu, allowing recovery of deleted files from supported file systems.
How do I run a basic testdisk example?
Run `sudo testdisk` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does /log do in testdisk?
Append all operations and analysis results to testdisk.log in the current directory.