使用extundelete恢復linux ext3 ext4文件系統下由 rm -rf 誤刪除文件

zz http://qyiyunso.blog.163.com/blog/static/350776862010826115537113/

今天一時手快 rm -rf .* ,刪除了一個重要郵件目錄,幸好通過extundelete恢復了。
記下操作流程:
1.準備工作
主要通過
extundelete 0.2.0完成恢復
需要依賴兩個包

sudo aptitude install e2fsprogs e2fslibs-dev

下載頁面http://extundelete.sourceforge.net/

快速下載: download extundelete

編譯三部曲

./configure
make
sudo make install

2.如果分區已經掛載,先umount,並且在將要恢復的地方查看空間大小

df -h ./

如果你要恢復的是根目錄或者系統目錄就只有拿硬盤掛到另外一臺電腦上操作了。

3.恢復制定分區下所有刪除文件,默認恢復到執行命令的目錄下,文件夾名字爲RECOVERED_FILES,使用詳情請參考:extundelete --help 運行的結果

sudo extundelete /dev/sda8 –restore-all

---------------------------------------------

$ extundelete --help

Usage: extundelete [options] [--] device-file

Options:

  --version, -[vV]       Print version and exit successfully.

  --help,                Print this help and exit successfully.

  --superblock           Print contents of superblock in addition to the rest.

                         If no action is specified then this option is implied.

  --journal              Show content of journal.

  --after dtime          Only process entries deleted on or after 'dtime'.

  --before dtime         Only process entries deleted before 'dtime'.

Actions:

  --inode ino            Show info on inode 'ino'.

  --block blk            Show info on block 'blk'.

  --restore-inode ino[,ino,...]

                         Restore the file(s) with known inode number 'ino'.

                         The restored files are created in ./RESTORED_FILES

                         with their inode number as extension (ie, file.12345).

  --restore-file 'path'  Will restore file 'path'. 'path' is relative to root

                         of the partition and does not start with a '/' (it

                         must be one of the paths returned by --dump-names).

                         The restored file is created in the current

                         directory as 'RECOVERED_FILES/path'.

  --restore-files 'path' Will restore files which are listed in the file 'path'.

                         Each filename should be in the same format as an option

                         to --restore-file, and there should be one per line.

  --restore-all          Attempts to restore everything.

  -j journal             Reads an external journal from the named file.

  -b blocknumber         Uses the backup superblock at blocknumber when opening

                         the file system.

  -B blocksize           Uses blocksize as the block size when opening the file

                         system.  The number should be the number of bytes.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章