This is my personal toolkit for studying filesystems in Linux. The ff crate serves as a utility for mounting, and dealing with filesysems in all binaries.
- ff-cache: Show or evict cached pages for a file.
- ff-trace-fsync: See how
fsyncbehaves under different conditions (e.g. block IO errors, multiple open file handles, different filesystems) - ff-bench-fsync: Benchmark syncing data to disk using different methods (whether it's an
fsynccall, or a filesystem mounted with thesyncoption, or a file opened withO_SYNCetc...)
Show or evict cached pages in the page cache.
It is similar to vmtouch but you can show dirty pages and inspect page mapping flags.
$ ff-cache target.txt
Resident Pages: 0/2560 0B/10MiB$ ff-cache target.txt
Resident Pages: 12/2560 48KiB/10MiB$ sudo ff-cache target.txt --dirty
Resident Pages: 13/2561 52KiB/10.00MiB
Dirty Pages: 1/2561
2560$ sudo ff-cache target.txt -e
Evicted 13/2561 52KiB/10.00MiB$ sudo ff-cache target.txt --dirty
Resident Pages: 1/2561 4KiB/10.00MiB
Dirty Pages: 0/2561benchmark fsync(2) and related system calls.
ff needs a partition that will be used to do all sorts of tests and benchmarks, it will refuse to work if the partition label is not ff-bench, which can be set using parted
sudo parted /dev/<YOUR_DRIVE> name <TESTING_PART_NUMBER> ff-bench