linux系統(tǒng)沒有像windows那樣的回收站,但誤刪文件并非完全無法恢復(fù)。本文介紹幾種linux下恢復(fù)誤刪文件的方法,請注意,恢復(fù)成功率并非100%,操作前務(wù)必停止對目標(biāo)分區(qū)的所有寫入操作。
extundelete專用于恢復(fù)ext3和ext4文件系統(tǒng)中的刪除文件,利用文件系統(tǒng)日志信息進(jìn)行恢復(fù)。
安裝:
centos: yum install extundelete
Debian: apt-get install extundelete
使用方法:
恢復(fù)單個(gè)目錄:extundelete /dev/vdb1 –restore-Directory /path/to/directory
恢復(fù)單個(gè)文件:extundelete /dev/vdb1 –restore-file /path/to/file
恢復(fù)所有刪除文件:extundelete /dev/vdb1 –restore-all (謹(jǐn)慎使用)
方法二:lsof命令
lsof命令列出被進(jìn)程打開的文件。如果刪除的文件仍在被進(jìn)程使用,lsof可能幫助恢復(fù)。
使用方法:
lsof | grep deleted
根據(jù)輸出結(jié)果手動恢復(fù)文件。
方法三:其他數(shù)據(jù)恢復(fù)工具
除了extundelete,foremost、testdisk、photorec等工具也可能有效。
foremost示例 (恢復(fù)png文件): foremost -t png -i /dev/sdb1
testdisk用于分區(qū)恢復(fù): testdisk
重要提示:
- 立即停止對目標(biāo)分區(qū)的寫入操作,防止數(shù)據(jù)被覆蓋。
- 數(shù)據(jù)恢復(fù)成功率無法保證,建議定期備份重要數(shù)據(jù)。
- 使用任何恢復(fù)工具前,請仔細(xì)閱讀其使用說明。
- 數(shù)據(jù)恢復(fù)復(fù)雜,如有疑問,請尋求專業(yè)人士幫助。
記住,數(shù)據(jù)恢復(fù)并非易事,操作前請謹(jǐn)慎,并做好充分的準(zhǔn)備工作。