What Happens When a File is Deleted

A filesystem is like the book keeping of the files, their location on the disk, the free space that exists and many other stuff.
It's very important, unlike the partition table and the entries of partitions since if it gets corrupted the files can be difficult to retrieve.
There are many different filesystems, each with different features. For example NTFS FAT ext4 etc.

When a file is deleted, the data on the disk is not erased. What happens is that the entry that refers to the data is deleted and the space is marked as free.
The data remains on the disk until it is overwritten when new files are created or more data is added.

This means that after deleting a file, the data can still be retrieved.
If you're interested in retrieving your deleted files click on How to Recover a File

Partition table, Partitions, Filesystems, Testdisk