How to Recover Accidentally Deleted Linux Images with PhotoRec and EasyRecovery
This guide explains how a mistaken script moved and deleted Linux image files, then details step‑by‑step recovery using TestDisk/PhotoRec, the qphotorec GUI, and EasyRecovery, highlighting search strategies, common pitfalls, and results with restored filenames and metadata.
I wrote a script to automatically rename downloaded images, but a bug moved all pictures from /media/disk/picure to the script’s working directory /root/bin. Assuming the original folder still contained the files, I deleted everything in the current directory.
From last night to today I spent time testing different software and methods to recover the data.
Using TestDisk/PhotoRec on Linux
Run photorec from the TestDisk suite to recover image files. If the terminal version is inconvenient, install the GUI version with dnf install qphotorec (see the referenced guide). When configuring, select only the unallocated space (Free: from the unallocated space only) to avoid long scans and irrelevant Chrome cache images.
I tested three search locations:
Search all images in /root/硬盘 (70 GB space)
Search only unallocated space in /root/硬盘 (less than 70 GB)
Search only unallocated space in /media/disk (500 GB)
Scanning the entire 70 GB space yielded the most results, so avoid scanning the whole disk when possible.
The recovered images have several issues: filenames are not original, metadata is lost, and files are stored sequentially by disk position, making it hard to locate specific pictures.
Debugfs fix from Baidu experience The document contains an error in the dd if= of= step, producing unreadable results. It is strongly discouraged unless you are very familiar with the dd command.
EasyRecovery I only tested recovery of files in /media/disk , and the results were excellent. Download the software from the official English site (avoid Chinese mirrors that may contain counterfeit versions). The free version did not work for me; a version with a keygen was needed. Using EasyRecovery restored images with their original filenames, folder hierarchy, and metadata.
Original article: http://yulijia.net/cn/软件世界/2016/02/29/easyRecovery-and-photorec.html
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
