Linuxext3 file system data recovery rm command delete file recovery

Source: Internet
Author: User
Environment: CentOS5.3X86 _ 64 example partition of the Operating System: devsdb1 is mounted to the data Partition. Example scenario: there is a test directory in the root directory of data, and there are two subdirectories and two files under the directory, there are still files in the subdirectory. I deleted all files in the test directory and then restored it. The conclusion is that the file can be successfully restored, but the directory cannot be recovered directly.

Environment: CentOS 5.3 X86_64 Operating System

Example partition:/dev/sdb1 mounted on/data Partition

Example scenario: there is a test directory in the root directory of/data, there are two subdirectories and two files under the directory, There are files under the subdirectory, I delete all the files under the test directory and then restore, the conclusion is that the file can be successfully restored, but the directory cannot be recovered directly. Only files under the directory can be restored separately (the directory structure is in)

1. Check whether the file system isExT3 File System

[Root @ MFS-chunkserver-2] # partEd/Dev/sdb1

2. View partition information

[Root @ MFS-chunkserver-2] #Df-Lh

3. view the directory structure

[Root @ MFS-chunkserver-2] #Cd/Data/test/

[Root @ MFS-chunkserver-2] #TrEe

4. Delete all files and directories under/data/test

[Root @ MFS-chunkserver-2] #Rm-Rf *

[Root @ MFS-chunkserver-2] #Ls

[Root @ MFS-chunkserver-2] #

5. Start to install the recovery tool

[Root @ MFS-chunkserver-2] # tar zxvf ext3Grep-0.10.1.tar.gz
[Root @ MFS-chunkserver-2] # cd ext3grep-0.10.1
[Root @ MFS-chunkserver-2] #./configure
[Root @ MFS-chunkserver-2] # make
[Root @ MFS-chunkserver-2] # make install

6. Detach a partition

[Root @ MFS-chunkserver-2] # cd/

[Root @ MFS-chunkserver-2] #Umount/Data/

7. Go to the/data directory to view inode information.

[Root @ MFS-chunkserver-2] # cd/data/

[Root @ MFS-chunkserver-2] # ext3grep/dev/sdb1 -- ls -- inode 2 (you can see that the test directory has been found at the end)

8. Record the inode information of the test directory, and then continue to find the Directory and file inode information under the test directory.

[Root @ MFS-chunkserver-2] # ext3grep/dev/sdb1 -- ls -- inode131081(Inode here)

9. The deleted directories a and B are found, and inode information is recorded to restore the directory.

[Root @ MFS-chunkserver-2] # ext3grep/dev/sdb1 --Restore-Inode 131082 (directory)

Related Article

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.