Installation on Linux Ubuntu/Debian:
sudo apt-get install testdisk
sudo testdisk sudo photorec
After starting, the utility displays a list of storage devices.
After selecting a device, a list of its partitions will be displayed.
After selecting a partition, you must select the file system format.
Next, you need to select the space for scanning, free or all.
Next, you need to select the directory for saving the recovered files.
/log (write photorec.log file)
/debug (add debugging information)
/d recup_dir (directory for saving recovered files)
device|image.dd|image.e01 (select a device or image to restore)
/version (view program version)
Official website: www.cgsecurity.org
See also my article:
Data recovery with extundelete