Skip to content

possible composefs /etc improvements #2627

Open

Description

@jeckersb

Currently with the composefs backend populating /etc for a deployment is basically:

  • mount the erofs for the new image
  • cp -a /etc into /sysroot/state/deploy/*/etc
  • does the 3-way merge in place, and then bind mounts the deployment /etc directly into the final system

At the very least instead of copying all of the files out of the image on each deployment, we should be able to reflink each from the object store and not duplicate the data.

Going a bit further, we could do something like:

  • /sysroot/state/deploy/*/etc instead just becomes an overlayfs upperdir
  • we mount the erofs from the image and use its /etc as a lowerdir with above
  • perform the 3-way merge on the overlay

No copying (except for internal overlay ops), and I think this also allows us to optimize the 3-way merge? Since we can just look at the upperdir on the previous deployment to know exactly which files have been modified and do the copy (reflink?) directly from those files.

Something like that. I haven't looked into proving this out, but wanted to write it down before I forget.

Activity

  1. Johan-Liebert1 commented on Nov 6, 2026

    @Johan-Liebert1
    Member

    Sounds like a good idea. I wonder if reflinking is as simple as adding --reflink to our cp command

  2. jeckersb commented on Nov 6, 2026

    @jeckersb
    CollaboratorAuthor

    Sounds like a good idea. I wonder if reflinking is as simple as adding --reflink to our cp command

    For the first (simple) case I don't think so because we're viewing it through the erofs when doing the cp so it's going from /sysroot -> erofs -> /sysroot and having it cross that fs boundary twice is going to lose the context.

    If we do the overlay/upperdir thing, then I think we might be able to just blindly cp --reflink from old to new...

  3. Johan-Liebert1 commented on Nov 11, 2026

    @Johan-Liebert1
    Member

    Another thing, currently we don't have fsverity enabled on files in /etc because we expect them to be writable. Some users may just want /etc to be not modifiable and have some sort of overlay (maybe sysexts) for writing to /etc. In such cases, we probably should not have a separate mount for /etc

  4. travier commented on Nov 12, 2026

    @travier
    Contributor

    composefs-rs started with /etc as an overlayfs but this has downsides (see: #1469) so we implemented the three way merge (#1485).

    I don't think it will be possible to use reflinks during the copy from the mounted image to the sysroot as this crosses filesystem boundaries (EROFS/ext4) and reflinks can not be used in this case AFAIK.

    Maybe we could implement a smarter copy/3-way-merge that compares the fs-verity hash of the files in /etc in the old image and the new image and then does a reflink from the current config in /etc if the file has not been modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions