Restore A Single File deleted in Linux, not a partition

Source: Internet
Author: User

Restoring and deleting a single file in Linux is not a partition Summary: Linux has many tools for restoring and deleting partitions by mistake. Sorry, I won't use it! But I have not recovered a single file. From this article, I will write a tool like this. How many people are interested !? File Deletion: 1. set the identifier corresponding to the occupied disk block to available; 2. set the identifier corresponding to the inode Node space occupied to available. 3. deleting the file entry in the file directory is like cutting the hook. File reply is the reverse operation of deletion, but the speed is slower. File Restoration: 1. set or save the directory you want to restore; 2. read the super block of the corresponding partition. The super block contains the inode node ing table and the disk space ing table. 3. obtain the inode starting area from the super block, and then scan each inode: because all attributes of the file except the file name (such as the file size and Creation Time) are in the inode, therefore, the nodes that meet the attributes are obtained and the node's logo in the super block has been set to available. Then, the size of the file and the entry of each disk block are found from the inode in sequence, if the marker corresponding to the entry (found at the super block) has been used, the file cannot be replied; if all entries are not used again, all entries are set to used. Then, set the inode flag for this file. Finally, add an entry under the directory saved in step 1. The inode Number of the entry points to the inode corresponding to the file being processed, and the file name is random. END
 

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.