You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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...
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
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.
Activity
Johan-Liebert1 commentedon Nov 6, 2026
Sounds like a good idea. I wonder if reflinking is as simple as adding
--reflinkto ourcpcommandjeckersb commentedon Nov 6, 2026
For the first (simple) case I don't think so because we're viewing it through the erofs when doing the
cpso 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 --reflinkfrom old to new...Johan-Liebert1 commentedon Nov 11, 2026
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
travier commentedon Nov 12, 2026
composefs-rs started with
/etcas 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
/etcin the old image and the new image and then does a reflink from the current config in/etcif the file has not been modified.