Nightmare mode: simulating disk failures
Antithesis built a custom Rust FUSE filesystem called Amnesia to simulate complex disk failures like power loss, I/O errors, and latency for distributed systems testing.
read it Offers a detailed engineering breakdown of how to simulate subtle storage faults like power loss and torn writes using a custom FUSE filesystem.
summary
Antithesis developed a disk fault injector named Amnesia to help test distributed storage engines against realistic hardware failures. Operating as a custom FUSE filesystem in Rust, Amnesia models complex failure modes that standard container kills miss, including exact page-cache loss during power outages, EIO handling on fsync, and out-of-order or partially completed operations. This approach successfully uncovered a subtle data-corruption bug in bbolt, the storage engine behind etcd.
key points
- Amnesia is a custom Rust FUSE filesystem that intercepts storage operations to model volatile and durable states entirely in memory without touching a real disk.
- Simulating power loss requires clearing internal caches concurrently with process termination to mimic the loss of kernel page caches and writeback.
- Injecting an EIO error on fsync without re-dirtying pages replicates the fsyncgate bug, exposing dangerous recovery assumptions in databases like etcd's bbolt.
- Concurrency testing uses fuzzer-controlled disk latency to complete operations out-of-order or expose torn reads and writes.
who should read it
Systems and infrastructure engineers building reliable storage engines or distributed databases.
discussion mixed
Interesting that they didn't go with device mapper, there are already few modules aimed at simulating bad hardware, and also far faster
Questions why the team did not use the Linux device mapper layer, which offers faster hardware fault simulation.
Generated by an LLM from the article and thread. Check the sources before relying on it.