今天突然想到要測試下文件恢復,網上看到很多人用一款ext3grep的軟體,下下來使用后發現 效果不佳,只能恢復小文件,不能恢複目錄.後來又找到一款名叫extundelete的軟體,使用后發現不錯,官網據說還能恢復ext4文件系統下的文件
以下是實驗記錄:
[root@localhost tmp]# cd /boot
[root@localhost boot]# mount -o remount,rw /boot
[root@localhost boot]# ll
總計 10795
-rw-r--r-- 1 root root 12288 2009-01-22 config-2.6.18-128.el5
drwxr-xr-x 2 root root 1024 05-13 01:49 grub
drwxr-xr-x 2 root root 1024 05-12 01:57 grub_bak
-rw------- 1 root root 3383766 02-24 17:09 initrd-2.6.18-128.el5.img
drwx------ 2 root root 12288 02-24 16:52 lost found
-rw-r--r-- 1 root root 80032 2009-03-17 message
drwxr-xr-x 2 root root 1024 05-12 01:53 mynewkernel
-rw-r--r-- 1 root root 102182 05-13 02:11 symvers-2.6.18-128.el5.gz_bak
-rw-r--r-- 1 root root 1784432 05-11 23:45 System.map
-rw-r--r-- 1 root root 1188481 2009-01-22 System.map-2.6.18-128.el5
-rw-r--r-- 1 root root 1889308 2009-01-22 vmlinuz-2.6.18-128.el5
-rw-r--r-- 1 root root 2538768 05-12 01:50 vmlinuz-2.6.38.6
[root@localhost boot]# rm -rf config-2.6.18-128.el5
[root@localhost boot]# sync
確定刪除了config-2.6.18-128.el5 文件
[root@localhost boot]# mount -o remount,ro /boot
為了安全,把要恢復的分區掛載為只讀
extundelete的下載與安裝就不寫說來了
現在開始恢復
cd /tmp
[root@localhost tmp]# /usr/local/extundelete/bin/extundelete /dev/sda1 --ls --inode 2
#先用命令檢索下分區下文件
File name | Inode number | Deleted status
Directory block 512:
去文件夾下的RECOVERED目錄下看看
[root@localhost tmp]# ll RECOVERED_FILES/
總計 12
-rw-r--r-- 1 root root 12288 05-13 02:25 config-2.6.18-128.el5
文件恢復成功 !
補充:
extundelete是唯一一款能恢復lvm(邏輯卷管理)的 軟體,恢復步驟是一樣的,恢復文件夾的話用選項--restore-all 在linux centos5.3 lvm上恢復50M的文件夾成功.
另外要注意的是,文件恢復后但文件的許可權可能不同了,軟連接可能也不同,我試驗了恢復了軟連接的時候恢復到了源文件.
本文出自 「你就當我是浮誇吧」 博客,請務必保留此出處http://2804976.blog.51cto.com/2794976/565095
[火星人 ] linux下實例恢復被刪除文件已經有649次圍觀