Just to explain a little more on what goes on when you create a file and populate it with data. Here's a simplified and somewhat generic example:
- file creation request is made
- an entry for that file is added to the directory where the file will live (in Linux, that entry is called an inode)
- if and when data is added to the file, storage blocks are allocated / taken from a free list by the filesystem
- the directory entry for that file gets updated with links/pointers to the storage blocks that were allocated
/
mydirectory [directory]
file pointer entry for
file1.txt
pointer to now allocated storage block (#1111)
pointer to now allocated storage block (#1112)
pointer to now allocated storage block (#1113)
file pointer entry for
file2.txt
pointer to now allocated storage block (#2222)
pointer to now allocated storage block (#2223)
pointer to now allocated storage block (#2224)
So now imagine that you've deleted
file1.txt...what happens next?:
- storage blocks #1111, #1112, and #1113 are
de-allocated and
made available/free to be allocated to other files
- if
file2.txt grows, it's entirely possible that one or more of the now free storage blocks #1111, #1112, and #1113 could be assigned and allocated for
file2.txt; so things might now look like this:
/
mydirectory [directory]
file pointer entry for
file2.txt
pointer to now allocated storage block (#2222)
pointer to now allocated storage block (#2223)
pointer to now allocated storage block (#2224)
pointer to now allocated storage block (#1111)
As you can see, block #1111 that was previously used by
file1.txt has now been used and re-written with contents for
file2.txt, thereby making the recovery and reassembly of
file1.txt impossible.
Hope that helps!