Home > Article > Operation and Maintenance > How to recover accidentally deleted files in Linux
How to recover accidentally deleted files in Linux
As a multi-user, multi-tasking operating system, Linux Once the files are deleted, they are difficult to recover. Although the delete command only marks the file node for deletion and does not actually clear the file content, other users and some processes that write to the disk will quickly overwrite the data. However, it can still be restored if you use Linux on a single computer at home, or if you accidentally delete files and remedy them in a timely manner.
1. Use SecureCRT to remotely monitor the operating system and check the current system version number and file system format
2. To facilitate this experiment, we create a new file.
3. Perform the deletion operation
rm -rf web_1.txt
4. Use the system self-restore tool debugfs to repair
5. Open the partition where the file was just deleted
View the directory in the partition
6. Use ls plus the -d parameter to display the directory where the file just deleted is located
##7. The one shown with angle brackets is the Inode number of the file we are looking for. Execute logdump –I
Eight, after executing the command, a screen of information is displayed. What we need is the following line, and remember the following value
9. Exit dedugfs
qiut
10. Execute the following command
bs The offset value is consistent with the figure below, and the skip and block values are consistent Eleven, the above results indicate that the recovery is successful. Let’s see if there are any in the /opt/wb_1 directory.
Restored successfully!
Recommended:The above is the detailed content of How to recover accidentally deleted files in Linux. For more information, please follow other related articles on the PHP Chinese website!