Alexander Larsson, creator of Flatpak and working at Red Hat, presented a preliminary patch for the implementation of the Composefs file system for the Linux kernel. The proposed file system resembles Squashfs and is also suitable for mounting images in read-only mode. The differences concern the provision of efficient shared storage of the contents of several mounted disk images and support for the verification of read data's authenticity. Use cases for Composefs include container image mounting and applications for Git-like OSTree repositories.
Composefs utilizes a content-addressable storage model, meaning that the primary identifier is not the file name, but rather a hash of the file's content. This model allows for deduplication and enables the storage of only one copy of identical files appearing in different mounted sections. For instance, container images contain numerous standard system files, and with Composefs, each of these files will be shared among all mounted images without employing tricks like hard links. Furthermore, common files are stored as a single copy on disk and counted as one entry in the page cache, allowing for savings in both disk and RAM.
To save disk space, data and metadata in the mounted images are separated. When mounting, the following are specified:
- A binary index that contains all the file system metadata, file names, access rights, and additional information, excluding the actual file contents.
- The base directory where the contents of all mounted images are stored. Files are stored linked to the hash of their content.
Indexul binar este creat pentru fiecare imagine a FS, iar catalogul de bază este unic pentru toate imaginile. Pentru a verifica conținutul fiecărui fișier și întregii imagini în condiții de stocare comună, se poate utiliza mecanismul fs-verity, care, la accesarea fișierelor, verifică dacă hash-urile specificate în indexul binar corespund conținutului efectiv (adică, dacă un atacator modifică un fișier din catalogul de bază sau datele sunt corupte din cauza unei defecțiuni, o astfel de verificare va identifica discrepanțele).
Sursa: opennet.ro
