Filesystems

2 Posts

Why Page Cache Makes File I/O Different From Direct Disk Access

8 minute

Linux devices often show behavior that looks odd at first: a large file is much faster to read the second time; write() returns quickly after writing data; free shows less available memory even though the system is not really leaking memory.

The same mechanism is often behind all of these observations: Page Cache.

Page Cache is the kernel layer that caches file contents in memory. It prevents file reads and writes from touching much slower storage on every operation. On reads, the kernel can check the cache first. On writes, the kernel can update cached pages first and write them back to storage later.

Read More

Why Filesystems Fear Sudden Power Loss

7 minute

Many field failures end with the same sentence: the device lost power right after writing configuration, and after reboot the file was damaged.

The application clearly called write(), and it even returned success. The filesystem may not be completely broken, but a config file becomes empty, a log tail is garbage, a database rolls back, or an update package fails verification.

This is often misunderstood as “the filesystem is unreliable.” A more accurate view is: filesystems trade off performance, lifetime, and consistency; applications must also define whether they need write return, storage persistence, or a complete business update.

Read More