1 Get root access switch root
2 Install E2fsprogs, some Linux comes with, some do not own, need to install
3 Debugfs/dev/sda3 (the file is in the same partition)
4 Wait until debugs: Enter Lsdel (lists the deleted files) please wait
5 depending on the deletion time, find the inode number of the file
6 Dump <inode >/xx/xx/file
Do not modify and write the file once it has been mistakenly deleted, because it is restored immediately to prevent the inode of the deleted file from being overwritten
You should pay attention to the RM later. To avoid this situation again, write a script to transform RM into a move into the Recycle Bin, similar to Windows, to execute directly in Bash_profile.
- Mkdir-p ~/.trash
- Alias Rm=trash
- Alias R=trash
- Alias rl=' ls ~/.trash ' //RL command to display files in recycle bin
- Alias ur=undelfile //ur command to retrieve files from recycle bin
- Undelfile () //Retrieve the files under the Recycle bin
- {
- Mv-i ~/.trash/\[email protected].
- }
- Trash ()
- {
- MV [email protected] ~/.trash/
- }
- Cleartrash ()
- {
- Read-p "Clear sure?[ N] "Confirm
- [$confirm = = ' y '] | | [$confirm = = ' Y '] &&/bin/rm-rf ~/.trash/*
- }
Linux Restore mistakenly deleted files