Restoration of rm-f file deletion in linux

Source: Internet
Author: User
In linux, the rm-f file deletion restoration method uses the ext3grep tool to restore data. you can download the ext3grep package from the official website and decompress and install it. Www.2cto. com1.ext3grep/data/afh -- ls -- inode2:/data/afh is the directory for data loss... in linux, the rm-f file deletion restoration method uses the ext3grep tool to restore data. you can download the ext3grep package from the official website and decompress and install it. Www.2cto.com 1. ext3grep/data/afh -- ls -- inode 2:/data/afh indicates the directory for data loss. here, inode information of the/data/afh directory is listed. inode information of the directory is generally 2. (this command mainly scans all file information in the current file system, including existing and deleted files. the deleted files contain the D mark, if you do not remember the name of the deleted file, you can use the following command to obtain the name of the file to be restored.) 2. ext3grep/data/afh -- dump-names: this command lists all file information in the current file system. 3. now we can restore the deleted data. [Root @ jiankong/] # mkdir-p/data/[root @ jiankong/] # dd if =/dev/zero of =/data/afh bs = 1024 count = 1024010240 + 0 records in10240 + 0 records out10485760 bytes (10 MB) copied, 0.0448091 s, 234 MB/s [root @ jiankong/] # mkfs. ext3/data/afhmke2fs 1.41.12 (17-May-2010)/data/afh is not a block special device. proceed anyway? (Y, n) yFilesystem label = OS type: LinuxBlock size = 1024 (log = 0) Fragment size = 1024 (log = 0) Stride = 0 blocks, stripe width = 0 blocks2560 inodes, 10240 blocks512 blocks (5.00%) reserved for the super userFirst data block = 1 Maximum filesystem blocks = 104857602 block groups8192 blocks per group, 8192 fragments per group1280 inodes per groupSuperblock backups stored on blocks: 8193 Writing inode tables: done Cr Eating journal (1024 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 23 mounts or180 days, whichever comes first. use tune2fs-c or-I to override. [root @ jiankong/] # mkdir/afc [root @ jiankong/] # mount-o loop/data/afh/afc [root @ jiankong/] # cp/etc/passwd/ boot/*/afc/[root @ jiankong/] # cd/afh [root @ jiankong afc] # lscon Fig-2.6.32-279.el6.x86_64 symvers-2.6.32-279.el6.x86_64.gzinitramfs-2.6.32-279.el6.x86_64.img System. map-2.6.32-279.el6.x86_64lost + found vmlinuz-2.6.32-279.el6.x86_64passwd [root @ jiankong afc] # rm-rf * [root @ jiankong afc] # ls [root @ jiankong afc] # cd/opt/[root @ jiankong opt] # ls [root @ jiankong opt] # [root @ jiankong opt] # ext3grep/data/afh -- ls -- inode 2 Running ext3grep version 0.10.2WARNING: I don't kn Ow what EXT3_FEATURE_COMPAT_EXT_ATTR is. number of groups: 2 Loading group metadata... doneMinimum/maximum journal block: 218/1247 Loading journal descriptors... sorting... doneThe oldest inode block that is still in the journal, appears to be from 1361608793 = Sat Feb 23 16:39:53 2013 Number of descriptors in journal: 198; min/max sequence numbers: 2/27 Inode is AllocatedFinding all blocks tha T might be directories. d: block containing directory start, d: block containing more directory entries. each plus represents a directory start that references the same inode as a directory start that we found previusly. searching group 0: DD ++ D ++ Searching group 1: + Writing analysis so far to 'disk1. ext3grep. stage1 '. delete that file if you want to do this stage again. result of stage one: 3 inode S are referenced by one or more directory blocks, 1 of those inodes is still allocated. 2 inodes are referenced by more than one directory block, 1 of those inodes is still allocated. 0 blocks contain an extended directory. result of stage two: 1 of those inodes cocould be resolved because it is still allocated. 1 inodes cocould be resolved because all refering blocks but one were journal blocks. all di Rectory inodes are accounted! Writing analysis so far to 'disk1. ext3grep. stage2 '. delete that file if you want to do this stage again. the first block of the directory is 204. inode 2 is directory "". directory block 204 :. -- File type in dir_entry (r = regular file, d = directory, l = symlink) |. -- D: Deleted; R: reallocatedIndx Next | Inode | Deletion time Mode File name =================================+ -------------- data-from-inode ------ + -- --------- + =========== 0 1 d 2 drwxr-xr-x. 1 end d 2 drwxr-xr-x .. 2 3 d 11 D 1361608866 Sat Feb 23 16:41:06 2013 drwx ------ lost + found 3 7 r 12 D 1361608866 Sat Feb 23 16:41:06 2013 rrw-r -- profile 4 6 r 13 D 1361608866 sat Feb 23 16:41:06 2013 rrw-r -- hosts 5 6 r 14 D 1361608866 Sat Feb 23 16:41:06 2013 rrw-r -- config-2.6.32-279.el6.x86_64 6 7 r 15 D 1361608866 Sat Feb 23 16:41:06 2013 rr W-r -- initramfs-2.6.32-279.el6.x86_64.img 7 8 r 1281 D 1361608866 Sat Feb 23 16:41:06 2013 rrw-r -- symvers-2.6.32-279.el6.x86_64.gz 8 9 r 1282 D 1361608866 Sat Feb 23 16:41:06 2013 rrw-r -- r -- System. map-2.6.32-279.el6.x86_64 9 end r 1283 D 1361608866 Sat Feb 23 16:41:06 2013 rrwxr-xr-x vmlinuz-2.6.32-279.el6.x86_64 10 end: execute the command to start searching for information about recoverable data files (including deleted and existing files). The D Mark contains deleted files. if you do not remember the deleted file name, you can use the following command. D 1284 D 1361608866 Sat Feb 23 16:41:06 2013 drwxr-xr-x ext3grep [root @ jiankong opt] # ext3grep/data/afh -- dump-namesRunning ext3grep version 0.10.2WARNING: I don't know what EXT3_FEATURE_COMPAT_EXT_ATTR is. number of groups: 2 Minimum/maximum journal block: 218/1247 Loading journal descriptors... sorting... doneThe oldest inode block that is still in the journal, appears to be from 1361608793 = S At Feb 23 16:39:53 2013 Number of descriptors in journal: 198; min/max sequence numbers: 2/27 Loading disk1.ext3grep. stage2... doneSystem. map-2.6.32-279.el6.x86_64config-2.6.32-279.el6.x86_64ext3grepext3grep/keys vmlinuz-2.6.32-279.el6.x86_64 [root @ jiankong opt] # ext3grep/data/afh -- restore-file ext3grep/hos TsRunning ext3grep version 0.10.2WARNING: I don't know what EXT3_FEATURE_COMPAT_EXT_ATTR is. WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set. this either means that your partition is still mounted, and/or the file system is in an unclean state. number of groups: 2 Minimum/maximum journal block: 218/1247 Loading journal descriptors... sorting... doneThe oldest inode block that is still in the journal, Appears to be from 1361610467 = Sat Feb 23 17:07:47 2013 Number of descriptors in journal: 193; min/max sequence numbers: 2/27 Writing output to directory RESTORED_FILES/Loading afh. ext3grep. stage2... doneCannot find an inode number for file "ext3grep/hosts ". [root @ jiankong opt] # lsafh. ext3grep. stage1 RESTORED_FILESafh.ext3grep.stage2 [root @ jiankong opt] # cd RESTORED_FILES/[root @ jiankong RESTORE D_FILES] # ls [root @ jiankong RESTORED_FILES] # cd .. [root @ jiankong opt] # ext3grep/data/afh -- restore-inode 12 Running ext3grep version 0.10.2WARNING: I don't know what EXT3_FEATURE_COMPAT_EXT_ATTR is. WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set. this either means that your partition is still mounted, and/or the file system is in an unclean state. number of groups: 2 Minimum/maximum journal block: 21 8/1247 Loading journal descriptors... sorting... doneThe oldest inode block that is still in the journal, appears to be from 1361610467 = Sat Feb 23 17:07:47 2013 Number of descriptors in journal: 193; min/max sequence numbers: 2/27 Restoring inode.12 [root @ jiankong opt] # lsafh. ext3grep. stage1 RESTORED_FILESafh.ext3grep.stage2 [root @ jiankong opt] # cd RESTORED_FILES/[root @ jiankong RESTORED_FILES] # Lsinode.12 [root @ jiankong RESTORED_FILES] # ext3grep/data/afh -- restore-allRunning ext3grep version 0.10.2WARNING: I don't know what else is. WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set. this either means that your partition is still mounted, and/or the file system is in an unclean state. number of groups: 2 Minimum/maximum journal block: 218/1247 Loading journal descrip Tors... sorting... doneThe oldest inode block that is still in the journal, appears to be from 1361610467 = Sat Feb 23 17:07:47 2013 Number of descriptors in journal: 193; min/max sequence numbers: 2/27 Writing output to directory RESTORED_FILES/Finding all blocks that might be directories. d: block containing directory start, d: block containing more directory entries. each plus represents a dire Ctory start that references the same inode as a directory start that we found previusly. searching group 0: DD ++ Searching group 1: Writing analysis so far to 'afh. ext3grep. stage1 '. delete that file if you want to do this stage again. result of stage one: 2 inodes are referenced by one or more directory blocks, 1 of those inodes is still allocated. 1 inodes are referenced by more than one direct Ory block, 1 of those inodes is still allocated. 0 blocks contain an extended directory. result of stage two: 1 of those inodes cocould be resolved because it is still allocated. all directory inodes are accounted! Writing analysis so far to 'afh. ext3grep. stage2 '. delete that file if you want to do this stage again. restoring System. map-2.6.32-279.el6.x86_64Restoring config-2.6.32-279.el6.x86_64Restoring initramfs-2.6.32-279.el6.x86_64.imgRestoring passwdRestoring symvers-2.6.32-279.el6.x86_64.gzRestoring vmlinuz-2.6.32-279.el6.x86_64 [root @ jiankong RESTORED_FILES] # lsafh. ext3grep. stage1 afh. ext3grep. stage2 in Ode.12 RESTORED_FILES [root @ jiankong RESTORED_FILES] # cd RESTORED_FILES/[root @ jiankong RESTORED_FILES] # lsconfig-2.6.32-279.el6.x86_64 System. map-2.6.32-279.el6.x86_64lost + found vmlinuz-2.6.32-279.el6.x86_64passwd after the recovery of friends this is mutual learning, wrong place everyone advice.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.