Some Interesting Tidbits About Filesystems and Storage
- Storage devices too have caches just like CPU caches!
[Ref1]
[Ref2]
- Assume, a write operation is performed on an HDD. Will HDD platters stop spinning after the write is done?
i.e. Do HDD platters spin even if the disk is idle?
Yes, they do!
[Ref1: See it yourself]
[Ref2]
- Assume you have a 1MB file. You overwrite 10th block of the file and then overwrite the 3rd block of the file.
Is it guaranteed that block written first (10th block) will be persisted before the
block written later (3rd block) i.e. are writes persisted in-order?
No! Modern IO stacks reorder blocks.
[Ref1]
[Ref2]
[Ref3]
[Ref4]