Question:
How does a filesystem overwrite deleted files?
Sloan
2012-08-21 12:35:23 UTC
Alright let me just explain some more. Alright so when you delete a file on a filesystem like FAT the file entry is removed from the file allocation table but the data is still present. Now eventually you will use up all of your harddrive space and the os will need to overwrite data from deleted files. How does it do this because ok lets say I have a 300 byte file and 40 bytes of free space from a deleted file then another file. Does the OS utilize the 40 bytes of space that are not used by the filesystem and if so then were does it store the information about were to write new data? I am a OS developer and wrote my own filesystem but this question has often troubled me.
Three answers:
peteams
2012-08-21 13:58:03 UTC
Files are normally allocated in clusters of sectors. Clusters that belong to files are indexed against the file. Unallocated or deallocated clusters are identified normally by something like a bitmap.



When you delete a file its clusters are market as free in the bitmap. What a file is created or an unallocated bit of a file is written an appropriate cluster is found in the bitmap, marked as in use and linked to the file.
2012-08-21 12:49:20 UTC
Good question, I've never really thought about that. But I myself am just getting into OS tweaking myself.



Have you ever come across this piece of text?

http://www.pjrc.com/tech/8051/ide/fat32.html



I think it covers interesting concepts of the matter.



See the "File Allocation Table - Following Cluster Chains" header



Can't provide a direct answer, sorry
2012-08-21 13:10:38 UTC
do i work with you........?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...