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