<?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr"><head><title>EER - ERIS-FS: A format for encoding file systems</title><style type="text/css">body {max-width: 900px; margin-top: 3em; margin-bottom: 2em; margin-left: auto; margin-right: auto; text-align: left; line-height: 1.6; font-family: sans-serif; font-size: 12pt;}
#logo {margin: auto; width: 70px; display: block;}
figure {width: 80%; display: block; margin: auto; padding: 2.0rem;}
h1 {text-align: center;}
h2 {margin-top: 3em;}
table {border-collapse: collapse; width: 100%; margin: 1.5rem 0;}
td, th {border: 1px solid black; text-align: left; padding: 0.5rem;}
th {background: goldenrod; font-weight: bold;}
pre { max-width: 100%; overflow: auto; background:#f0f0f0; padding: 10px;}
img { margin: auto; max-width: 70%; }
footer { text-align: right; font-weight: 200; padding-top: 5em; }
footer span { padding: 0 0.5em 0 0.5em; }
</style></head><body><svg id="logo" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><defs><clipPath id="inside"><circle cx="16" cy="16" r="12" /></clipPath></defs><circle cx="16" cy="16" r="14" fill="goldenrod" stroke="black" stroke-width="2" /><path id="symbol" d="M 6,6 A 8,8 0 0,1 6,26 M 16,1 V 31 M 26,6 A 8,8 0 0,0 26,26" fill="none" stroke="black" stroke-width="2" clip-path="url(#inside)" /></svg><nav><a href="index.html">back to index</a></nav><article><h1>ERIS-FS: A format for encoding file systems</h1><h2>Introduction</h2><p>ERIS defines how a sequence of bytes can be encoded and made available robustly. Many types of content can be serialized to a sequence of bytes that can be then encoded with ERIS. One type of content that deserves special attention are collections of files organized in a tree - file systems. ERIS-FS is a format of encoding file systems that is optimized for usage with the ERIS encoding. In particular, files that appear multiple times within a file system and also within multiple file systems can be de-duplicated using ERIS-FS. This is important for applications such as software package management (e.g. <a href="https://guix.gnu.org/">Guix</a> or <a href="https://nixos.org/">Nix</a>) where two versions of a package might share many common files.</p><p>A file system encoded with ERIS-FS can be decoded to a directory containing the tree of file system objects or be directly mounted.</p><p>ERIS-FS is similar to formats such as SquashFS, Tar or EROFS.</p><h3>File System Objects</h3><p>Operating systems have different kinds of objects with a lot of metadata that live in a file system. ERIS-FS only encodes minimal information that is required for simple file sharing and software packages:</p><ul><li>Regular files</li><li>Executable files</li><li>Symbolic Links</li></ul><p>This is directly inspired by file system objects encoded as handled by Nix or Guix (see <a href="https://edolstra.github.io/pubs/phd-thesis.pdf">Section 5.2.1 of Eelco Dolstra thesis</a>).</p><h3>Deterministic Encoding</h3><p>The same tree of file system objects is encoded to the same image by specifying a strict ordering of files. Metadata structures are encoded using deterministically encoded CBOR as defined in <a href="https://www.rfc-editor.org/rfc/rfc8949.html#section-4.2.1">section 4.2.1 of RFC 8949</a>.</p><h3>Limitations</h3><ul><li>Images are in general less compact than SquashFS, Tar or EROFS images (but offer much better de-duplication)</li><li>Can only handle a very limited set of files and metadata</li><li>Empty directories can not be encoded.</li></ul><h2>ERIS-FS Index</h2><p>ERIS-FS is a CBOR structure that holds the structure of the file system. Content of files is referenced with an ERIS read capability.</p><p>The ERIS-FS Index is described using CDDL <a href="https://datatracker.ietf.org/doc/html/rfc8610">RFC8610</a>:</p><pre><code class="language-CDDL">
eris-fs-index = #6.1701996916 [
    version = 1,
    { * path =&gt; entry }
  ]

path = [ * tstr ]
  
entry = file-entry / executable-entry / symlink-entry

file-entry = [ 
  type = 0,
  content = read-capability
]

executable-entry = [ 
  type = 1,
  content = read-capability
]

read-capability = #6.276 ( bstr )

symlink-entry = [
  type = 2,
  target: tstr
]
</code></pre><p>The index is tagged with the CBOR tag <code>1701996916</code> according to <a href="https://www.rfc-editor.org/rfc/rfc9277.html">RFC 9277</a>.</p><h3>Block size</h3><p>Files should be encoded using block size as recommended in the ERIS specification (see <a href="http://purl.org/eris/spec/#name-recommendation-on-block-siz">ERIS specification section 2.2.1</a>). That is files smaller than 16KiB should use block size 1KiB and larger files should use block size 32KiB.</p><p>The index should also be encoded using the same block size recommendation - block size 1KiB if the index is smaller than 16KiB and block size 32KiB else.</p><h2>MIME type</h2><p>The ERIS-FS MIME type is <code>application/x-eris-fs+cbor</code>.</p><p>This can be used to identify ERIS-FS file systems in applications or protocols.</p><h2>Implementation Notes</h2><h3>Detecting ERIS-FS</h3><p>An ERIS-FS file system can be detected by checking if the first five bytes are:</p><pre><code>0xDA65726974</code></pre><p>See also <a href="https://www.rfc-editor.org/rfc/rfc9277.html">RFC 9277</a>.</p><h3>Parallelization</h3><p>Creating and decoding ERIS-FS file systems can be parallelized by encoding/decoding files in parallel.</p><h3>Symbolic Links</h3><p>ERIS-FS can hold symbolic links that point outside of the encoded file system. This seems to be necessary for properly supporting Nix/Guix substitutes.</p><p>Symbolic links can be dangerous and implementations SHOULD issue a warning when decoding symbolic links that point outside of the encoded file system.</p><h2>Deprecated Version</h2><h3>Version 0</h3><p>Version 0 of the ERIS-FS format encoded all files into a continuous sequence of bytes that so that file boundaries are aligned to ERIS block boundaries. This version of the encoding is considered to be deprecated and SHOULD NOT be used.</p><p>The specification of the old version is available in the EER <a href="https://codeberg.org/eris/eer/src/branch/main/eer/eris-fs/index.md">Git repository</a>.</p><h2>Implementations</h2><ul><li><a href="https://codeberg.org/eris/guile-eris">Guile-ERIS</a></li><li>The <a href="https://codeberg.org/eris/nim-eris#mkerisfs">mkerisfs</a> tool which is part of <a href="https://codeberg.org/eris/nim-eris">nim-eris</a></li><li><a href="https://codeberg.org/eris/eris-go">eris-go</a></li></ul><h2>IANA Considerations</h2><h3>CBOR Tags Registry</h3><p>This specification requires the assignment of a CBOR tag:</p><ul><li>Tag: <code>1701996916</code></li><li>Data Item: <code>array</code></li><li>Semantics: ERIS-FS image header</li></ul><p>The tags is added to the CBOR Tags Registry as defined in <a href="https://www.rfc-editor.org/rfc/rfc8949.html">RFC 8949</a>.</p></article><footer><span><a href="https://codeberg.org/eris/eer/" title="Git repository from which this site is generated">Git</a></span><span><a href="https://creativecommons.org/licenses/by-sa/4.0/" title="Content licensed as CC-BY-SA-4.0">CC-BY-SA-4.0</a></span></footer></body></html>