linux系統誤刪文件怎麽辦!使用extundelete恢復數據
阿新 • • 發佈:2017-10-23
數據恢復 誤刪文件 linux
註意:刪除的第一時間要卸載文件系統。
一:環境搭建
1.下載http://extundelete.sourceforge.net/
2.安裝e2fsprogs和e2fsprogs-libs
yum install e2fsprogs e2fsprogs-libs -y
3.上傳文件至linux主機
put C:/Users/CPIC/Desktop/extundelete-0.2.4.tar.bz2
4.安裝軟件
tar jxvf extundelete-0.2.4.tar.bz2 cd /root/extundelete-0.2.4 ./configure make & make install
報錯: (1)configure: error: in `/root/Desktop/extundelete-0.2.4‘: configure: error: C++ compiler cannot create executables 解決:yum install gcc* -y (2)Configuring extundelete 0.2.4 configure: error: Can‘t find ext2fs library 解決:yum install e2fsprogs* -y
二:實驗
mkdir /shiyan #創建掛載目錄 fdisk /dev/sdb #劃分為一個主分區 n-p-1-w mount /dev/sdb1 /shiyan #掛載 cp -a /etc/passwd /shiyan/ #復制文件 cd /shiyan rm -rf passwd #刪除文件 umount /shiyan #卸載文件系統 [root@node1 /]# extundelete /dev/sdb1 --inode 2 #查看inode信息,重要!! NOTICE: Extended attributes are not restored. Loading filesystem metadata ... 8 groups loaded. Group: 0 Contents of inode 2: 0000 | ed 41 00 00 00 10 00 00 7c 8f ed 59 77 8f ed 59 | .A......|..Yw..Y 0010 | 77 8f ed 59 00 00 00 00 00 00 02 00 08 00 00 00 | w..Y............ 0020 | 00 00 00 00 03 00 00 00 49 00 00 00 00 00 00 00 | ........I....... 0030 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0080 | 1c 00 00 00 00 19 23 02 00 19 23 02 dc ff 9c b1 | ......#...#..... 0090 | 33 8f ed 59 00 00 00 00 00 00 00 00 00 00 00 00 | 3..Y............ 00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00b0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00d0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00f0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ Inode is Allocated File mode: 16877 Low 16 bits of Owner Uid: 0 Size in bytes: 4096 Access time: 1508740988 Creation time: 1508740983 Modification time: 1508740983 Deletion Time: 0 Low 16 bits of Group Id: 0 Links count: 2 Blocks count: 8 File flags: 0 File version (for NFS): 0 File ACL: 0 Directory ACL: 0 Fragment address: 0 Direct blocks: 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 Indirect block: 0 Double indirect block: 0 Triple indirect block: 0 File name | Inode number | Deleted status . 2 .. 2 lost+found 11 Deleted passwd 12 Deleted
恢復單個文件:extundelete /dev/sdb1 --restore-file 原來文件存儲的相對路徑
原來文件的存儲路徑為/data/passwd ,那麽參數後面直接指定passwd;如果原來的文件路徑為/data/test/passwd,那麽參數後面test/passwd.
恢復單個目錄:extundelete /dev/sdb1 --restore-directory /aaa
原來存儲目錄路徑為: /data/aaa
恢復所有刪除的數據:extundelete /dev/sdb1 --restore-all
最後在當前目錄下的RECOVERED_FILES目錄中找到誤刪的文件。
註意:刪除的第一時間要卸載文件系統。
本文出自 “獨上高樓,望盡天涯路” 博客,請務必保留此出處http://nxyboy.blog.51cto.com/10511646/1975244
linux系統誤刪文件怎麽辦!使用extundelete恢復數據