How to Recover Accidentally Deleted Linux Upload Files with extundelete
After a sudden incident deleted files from /data/webapps/xxxx/upload without backup, this guide walks through installing extundelete, locating the deleted inode data, and using extundelete commands to recover as much of the lost data as possible, including tips on mounting read‑only.
Background
A sudden incident deleted the data stored in /data/webapps/xxxx/upload with no backup available, causing urgent need for recovery. Using the extundelete tool, most of the deleted files were successfully recovered.
Install extundelete
1. Install via EPEL repository
If the EPEL repository is enabled, install extundelete directly:
yum install extundelete2. Compile from source
Alternatively, download the source code and compile:
git clone https://github.com/extundelete/extundelete.git cd extundelete && make && make installLocate Deleted Data
Because the data path is deep, locate the deleted files step by step, starting from the root partition inode.
We see the webapps directory inode, then the project inode, and finally the upload directory where the deleted files reside.
The final directory shows entries marked as Deleted , which are the target files for recovery.
Data Recovery
Recover the specified directory using the current partition as the root and mask the project name:
extundelete --restore-directory /data/webapps/xxxx/uploadBecause the disk is still being read‑written, some inodes have been reallocated, so a few files cannot be recovered. The tool reports the number of unrecoverable files, but most data is restored.
The recovered files are placed in a directory named RECOVERED_FILES created in the current working directory.
To recover all files, run:
extundelete --restore-allUsage
Run extundelete --help to see available options:
Options include: --version, -v: show version --help: show help --superblock: show superblock info --journal: show journal info --after dtime: files deleted after given time --before dtime: files deleted before given time Actions include: --inode ino: show info for inode --block blk: show info for block --restore-inode ino[,ino,...]: restore files by inode --restore-file 'path': restore a specific file --restore-files 'path': restore listed files --restore-all: attempt to restore everything -j journal: read journal file -b blocknumber: use backup superblock -B blocksize: specify block size
Important Precautions
After data deletion, unmount the affected disk or partition. If the root partition is affected, boot into single‑user mode and mount the root partition as read‑only.
Reason: Deleting a file only clears the inode’s block pointers; the data remains on disk until overwritten. Mounting read‑only minimizes the risk of overwriting the deleted blocks, increasing the chance of successful recovery.
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.
