fs-verity is a Linux kernel filesystem feature, merged in kernel 5.4, that provides read-only, content-addressable integrity verification at the individual file level. When fs-verity is enabled on a file (via the FS_IOC_ENABLE_VERITY ioctl), the kernel builds a Merkle tree of the file’s content blocks and stores it in a filesystem-specific location (in an ext4 or f2fs Merkle tree block range, or in a separate xattr-adjacent structure on btrfs). From that point, the file becomes immutable — writes are rejected — and every page read from the file is verified against the Merkle tree before being returned to userspace. The file’s fs-verity digest is the SHA-256 (or SHA-512) root hash of the Merkle tree, computable without reading the file at all once the tree is built: fsverity digest file returns this digest. A file’s fs-verity digest is a stable, content-derived identity: two files with the same content have the same digest, and any byte-level modification produces a different digest that verification will detect and reject with EIO. The kernel caches verified Merkle tree nodes in the page cache alongside file data, so the amortised verification overhead is low for sequentially-read files.
The operational model differs from dm-verity in scope and granularity. dm-verity protects an entire block device as a unit, with a single root hash committing the whole device; it cannot share blocks between two separately-verified volumes containing the same file. fs-verity protects individual files within a normally-writable filesystem, enabling a mixed-trust model where some files are verified (OS binaries, package contents) and others are not (logs, configuration, state), without partitioning the storage. The file’s Merkle tree is stored alongside the file in the same filesystem, so verified files survive copies and backups that preserve extended attributes and inode metadata. Critically, fs-verity enables content-addressable deduplication at the file level: a storage layout that uses hardlinks or composefs-style object stores can have multiple directory entries pointing to the same verified inode — the Merkle tree is computed once and shared, so the same file content verified in ten different container images costs one Merkle tree’s worth of storage and one verification path. This is the property that composefs depends on: its object store contains each unique file content exactly once, addressed by its fs-verity digest, and multiple composefs mounts (different OS images, different container layers) reference the same object store inodes, each getting fs-verity’s per-read integrity checks for free.
fs-verity integrates with three other systems in this glossary. IMA (Integrity Measurement Architecture) can read a file’s fs-verity digest from the kernel rather than computing a fresh SHA-256 hash on every access — the security.ima extended attribute can store the fs-verity digest as the reference value, and IMA appraisal compares the runtime digest against this stored value without re-reading the entire file, combining the correctness of content-based verification with the performance of an xattr lookup. This is the integrity = ima mode in fapolicyd. Android uses fs-verity for APK verification since Android 10: the Play Store’s application delivery mechanism (adb incremental) uses fs-verity to enable streaming installation — the kernel verifies each page of the APK on first access rather than requiring the entire file to be downloaded and verified before any part of it executes, enabling instant app launch from partial downloads while maintaining the same integrity guarantee as full pre-verification. composefs uses fs-verity as the content integrity layer for the object store backing its EROFS metadata images: when composefs mounts a tree, the verity overlayfs option (kernel 6.6+) instructs the kernel to enforce that each file’s content matches its fs-verity digest as recorded in the EROFS metadata — a single EROFS digest commits the metadata, the metadata commits every file’s fs-verity digest, and the kernel enforces both on every read. The composefs mount therefore achieves the same tamper-evidence property as a dm-verity image while maintaining the object-store sharing and incremental update properties of a file tree.
