Primarily out of curiosity, but also because I’d like to be able to restrict the amount of data that can possibly be written to areas like /var/lib that should never grow to more than a few tens of _kilo_bytes, I have been experimenting with use of very small (by modern standards) disk partitions. Unfortunately, it seems current generation filesystems are not designed for this.
- XFS, my usual first choice, cannot format a partition smaller than 300MB.
- f2fs won’t go smaller than 64MB.
- ext4 will go as small as 1MB, but in a 1MB partition you get no journal, and in a 2MB partition the journal takes up half of it. (The mkfs.ext4 manpage says flat out that the journal cannot be smaller than 1024 ext4 blocks, and ext4 blocks cannot be smaller than 1024 bytes, even if disk blocks are smaller than that.) ext4 also has a fixed-size inode table that in this case defaults to only 256 inodes, which could be a problem for the intended usage.
- VFAT can still handle traditional floppy disk sizes (I tested all the way down to 128K) but cannot be described as a current generation filesystem, and in particular it has no journal.
I cannot conveniently test more exotic options, but it seems unlikely that the authors of ZFS or btrfs, for example, would have bothered putting much effort into very small partitions. I know of read-only filesystems designed to pack as many files as possible into limited available space (cramfs, squashfs, etc) but I need something writable.
Is anyone aware of a well-supported modern file system that is designed to handle small partitions efficiently? “Modern” means, at a minimum, having a journal and not having a fixed-size inode table; “efficiently” means not reserving more than 5-10% of the available space for the journal and other internal data structures, and minimizing wasted space when there are many small files.
An offline filesystem consistency checker is also a hard requirement. I hate that I have to say this — but ZFS does not have one. (“zfs scrub” only checks block checksums; it does not validate or repair data structures. I lost data because of this.)