TestDisk package for Debian Stretch is from 2015. It is so old that I have to build it from the source code. Here is how I did it.
Install dependencies
Since I don't need a GUI, I exclude the Qt packages: qtbase5-dev qttools5-dev-tools.
apt-get -y install build-essential e2fslibs-dev libewf-dev libncurses5-dev apt-get -y install libncursesw5-dev ntfs-3g-dev libjpeg-dev uuid-dev apt-get -y install zlib1g-dev pkg-config dh-autoreconf git apt-get -y install debhelper dwz
Build TestDisk
# Get the source code from repository. git clone https://git.cgsecurity.org/testdisk.git # Compile. cd testdisk mkdir config autoreconf --install -W all -I config ./configure make # Install. make install
Note: As of 2020-03-09, make static
doesn't work.
Check version
Check that the latest version is indeed installed.
/usr/local/bin/testdisk --version # TestDisk 7.2-WIP, Data Recovery Utility, January 2020
Details of utilities
testdisk: When a file is deleted, the list of disk clusters occupied by the file is erased, marking those sectors available for use by other files created or modified thereafter. If the file wasn’t fragmented and the clusters haven’t been reused, TestDisk can recover the deleted file for various filesystem:
- FAT
- NTFS
- exFAT
- ext2
photorec: PhotoRec is a file carver data recovery software tool. It doesn’t recover the original filenames but it can recover delete files even from corrupted filesystem. PhotoRec recognizes and recovers numerous file formats including ZIP, Office, PDF, HTML, JPEG and various graphics file formats. The whole list of file formats recovered by PhotoRec contains more than 480 file extensions (about 300 file families). It’s possible to create custom signature to recover file format unknown to PhotoRec.