|
針對于ext4文件系統(tǒng)數(shù)據(jù)恢復(fù)軟件,看了網(wǎng)上好多都在介紹extundelete這個工具,下載最新版本實驗時(在Centos5.8、Centos6.7上實驗效果不是很好)。最終發(fā)現(xiàn)ext4magic對于ext4數(shù)據(jù)恢復(fù)支持還是非常強大的。也可以做到基于時間點、inode、指定文件恢復(fù)等等?;謴?fù)時需要卸載分區(qū),以只讀方式掛載恢復(fù)。具體軟件下載地址為: 1、安裝 可以參考官方INSTALL文件進行安裝,如有依賴需處理好包依賴方可進行安裝。系統(tǒng)必須安裝make、file 、gcc工具。以下libmagic、libext2fs、libz、libbz2庫必須安裝, # tar -xzf ext4magic-0.3.2.tar.gz # cd ext4magic-0.3.2 # ./configure # make # make install 2、測試 (1)、基于時間恢復(fù)(以1970-01-01 00:00:00 UTC的秒數(shù)開始計算) [root@jason1 ~]# mount /dev/sdb1 /media/ [root@jason1 ~]# cp -rp /boot/* /media/ [root@jason1 ~]# cd /media/ [root@jason1 media]# ll total 34884 -rw-r--r--. 1 root root 107134 Jul 24 00:13 config-2.6.32-573.el6.x86_64 drwxr-xr-x. 3 root root 4096 Dec 10 19:20 efi -rw-r--r--. 1 root root 166756 Jul 20 2011 elf-memtest86+-4.10 drwxr-xr-x. 2 root root 4096 Dec 10 19:33 grub -rw-------. 1 root root 27925110 Dec 10 19:31 initramfs-2.6.32-573.el6.x86_64.img drwx------. 2 root root 16384 Dec 10 18:17 lost+found -rw-r--r--. 1 root root 165080 Jul 20 2011 memtest86+-4.10 -rw-r--r--. 1 root root 205998 Jul 24 00:14 symvers-2.6.32-573.el6.x86_64.gz -rw-r--r--. 1 root root 2585052 Jul 24 00:13 System.map-2.6.32-573.el6.x86_64 -rw-r--r--. 1 root root 289193 Oct 15 2014 tboot.gz -rw-r--r--. 1 root root 12277 Oct 15 2014 tboot-syms -rwxr-xr-x. 1 root root 4220560 Jul 24 00:13 vmlinuz-2.6.32-573.el6.x86_64 [root@jason1 media]# date Mon Dec 14 19:36:06 CST 2015 [root@jason1 media]# rm -rf * [root@jason1 media]# cd [root@jason1 ~]# umount /dev/sdb1 [root@jason1 ~]# mount -o ro /dev/sdb1 /media [root@jason1 ~]# ext4magic /dev/sdb1 -d /home -a 1450086000 -m 3##改時間通過date命令獲取當(dāng)前時間秒數(shù)減去3600秒得來。 Warning: Activate magic-scan or disaster-recovery function, may be some command line options ignored "/home" accept for recoverdir Filesystem in use: /dev/sdb1 Using internal Journal at Inode 8 Activ Time after : Mon Dec 14 17:40:00 2015 Activ Time before : Mon Dec 14 19:44:26 2015 Inode 2 is allocated -------- /home/config-2.6.32-573.el6.x86_64 -------- /home/efi/EFI/redhat/grub.efi -------- /home/elf-memtest86+-4.10 -------- /home/grub/menu.lst -------- /home/grub/reiserfs_stage1_5 -------- /home/grub/e2fs_stage1_5 -------- /home/grub/xfs_stage1_5 -------- /home/grub/fat_stage1_5 -------- /home/grub/stage1 -------- /home/grub/iso9660_stage1_5 -------- /home/grub/splash.xpm.gz -------- /home/grub/vstafs_stage1_5 -------- /home/grub/ufs2_stage1_5 -------- /home/grub/device.map -------- /home/grub/stage2 -------- /home/grub/ffs_stage1_5 -------- /home/grub/minix_stage1_5 -------- /home/grub/jfs_stage1_5 -------- /home/grub/grub.conf -------- /home/initramfs-2.6.32-573.el6.x86_64.img -------- /home/memtest86+-4.10 -------- /home/symvers-2.6.32-573.el6.x86_64.gz -------- /home/System.map-2.6.32-573.el6.x86_64 -------- /home/tboot.gz -------- /home/tboot-syms -------- /home/vmlinuz-2.6.32-573.el6.x86_64 MAGIC-1 : start lost directory search MAGIC-2 : start lost file search MAGIC-2 : start lost in journal search MAGIC-3 : start ext4-magic-scan search -------- /home/MAGIC-3/text/plain/0000028685.txt -------- /home/MAGIC-3/text/plain/0000045944.txt ext4magic : EXIT_SUCCESS 驗證是否恢復(fù)成功 [root@jason1 ~]# cd /home/ [root@jason1 home]# ll total 34872 -rw-r--r--. 1 root root 107134 Jul 24 00:13 config-2.6.32-573.el6.x86_64 drwx------. 3 root root 4096 Dec 14 19:44 efi -rw-r--r--. 1 root root 166756 Jul 20 2011 elf-memtest86+-4.10 drwx------. 2 root root 4096 Dec 14 19:44 grub -rw-------. 1 root root 27925110 Dec 10 19:31 initramfs-2.6.32-573.el6.x86_64.img drwx------. 3 root root 4096 Dec 14 19:44 MAGIC-3 -rw-r--r--. 1 root root 165080 Jul 20 2011 memtest86+-4.10 -rw-r--r--. 1 root root 205998 Jul 24 00:14 symvers-2.6.32-573.el6.x86_64.gz -rw-r--r--. 1 root root 2585052 Jul 24 00:13 System.map-2.6.32-573.el6.x86_64 -rw-r--r--. 1 root root 289193 Oct 15 2014 tboot.gz -rw-r--r--. 1 root root 12277 Oct 15 2014 tboot-syms -rwxr-xr-x. 1 root root 4220560 Jul 24 00:13 vmlinuz-2.6.32-573.el6.x86_64 [root@jason1 home]# (2)、整個文件系統(tǒng)恢復(fù) [root@jason1 ~]# ext4magic /dev/sdb1 -d /home -m Warning: Activate magic-scan or disaster-recovery function, may be some command line options ignored "/home" accept for recoverdir Filesystem in use: /dev/sdb1 Using internal Journal at Inode 8 Activ Time after : Mon Dec 14 19:36:37 2015 Activ Time before : Mon Dec 14 19:56:58 2015 Inode 2 is allocated -------- /home/config-2.6.32-573.el6.x86_64 -------- /home/efi/EFI/redhat/grub.efi -------- /home/elf-memtest86+-4.10 -------- /home/grub/menu.lst -------- /home/grub/reiserfs_stage1_5 -------- /home/grub/e2fs_stage1_5 -------- /home/grub/xfs_stage1_5 -------- /home/grub/fat_stage1_5 -------- /home/grub/stage1 -------- /home/grub/iso9660_stage1_5 -------- /home/grub/splash.xpm.gz -------- /home/grub/vstafs_stage1_5 -------- /home/grub/ufs2_stage1_5 -------- /home/grub/device.map -------- /home/grub/stage2 -------- /home/grub/ffs_stage1_5 -------- /home/grub/minix_stage1_5 -------- /home/grub/jfs_stage1_5 -------- /home/grub/grub.conf -------- /home/initramfs-2.6.32-573.el6.x86_64.img -------- /home/memtest86+-4.10 -------- /home/symvers-2.6.32-573.el6.x86_64.gz -------- /home/System.map-2.6.32-573.el6.x86_64 -------- /home/tboot.gz -------- /home/tboot-syms -------- /home/vmlinuz-2.6.32-573.el6.x86_64 MAGIC-1 : start lost directory search MAGIC-2 : start lost file search MAGIC-2 : start lost in journal search MAGIC-3 : start ext4-magic-scan search -------- /home/MAGIC-3/text/plain/0000028685.txt ext4magic : EXIT_SUCCESS [root@jason1 ~]# (3)、指定文件恢復(fù) [root@jason1 ~]# ext4magic /dev/sdb1 -r -f grub/grub.conf -d /home "/home" accept for recoverdir Filesystem in use: /dev/sdb1 Using internal Journal at Inode 8 Inode found "grub/grub.conf" 655377 -------- /home/grub/grub.conf ext4magic : EXIT_SUCCESS [root@jason1 ~]# cd /home/ [root@jason1 home]# ll total 4 drwx------. 2 root root 4096 Dec 14 20:08 grub [root@jason1 home]# ll grub/grub.conf -rw-------. 1 root root 843 Dec 10 19:33 grub/grub.conf [root@jason1 home]# 指定文件恢復(fù)時,需要注意指定恢復(fù)文件的路徑書寫問題。以下給出官方的示例: An example: the mount point for this filesystem is " /home " an the filename for Linux is " /home/usr1/Document " you can use now # ext4magic /dev/sda3 -f usr1/Document (去掉掛在點目錄指定文件目錄)。 |
|
|