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: Linux restores a single file to be deleted, not a partition summary. in Linux, there are 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
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.