Linux File Deletion principle:
Linux is controlled by the number of link to delete the file, only if a file does not exist any link , the file will be deleted. In general, there are 2 link counters for each file: I_count and i_nlink.
The meaning of I_count is the number of users (or calls) of the current file , and the meaning of I_nlink is the number of media connections (number of hard links), which can be understood as I_count is a memory reference counter,I_nlink is the reference counter for the disk.
When a file is referenced by a process, the corresponding number of I_count is incremented, and the corresponding i_nlink number is incremented when a hard link to the file is created .
& Nbsp; for the delete command rm i_nlink rm The operation has deleted the file, then what will happen? rm After you delete the file, execute the ls
This is because rm operation just the i_nlink If there is no other link i_nlink 0 0 So even if you do rm operation, but the system does not really delete this file when only I_ Nlink i_count all 0
the above-mentioned I_nlink and I_count is the true condition of the file deletion, but when the file is not called, does the RM operation Delete the file after the deletion can be retrieved?
previously said,the RM operation only reduces the i_nlink of the file , or 0, the actual is to delete the file name to the Inode link, at this time, the entity is not deleted ( block data block), at this time, if the time to stop the machine work, the data can be retrieved, if you continue to write data, then when the new data may be allocated to the deleted data block blocks of data, at this time, the file will be really recycled, Then there is no way to be immortal.
How to delete linux files