engine: optimize copies to use hardlinks when possible#11497
Merged
sipsma merged 4 commits intodagger:mainfrom Dec 2, 2025
Merged
engine: optimize copies to use hardlinks when possible#11497sipsma merged 4 commits intodagger:mainfrom
sipsma merged 4 commits intodagger:mainfrom
Conversation
547bdc8 to
b8537fd
Compare
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
tiborvass
reviewed
Dec 2, 2025
| } | ||
| // TODO: is this robust? the one for submounts is very complicated | ||
| if state.rootMount.Selector != "" { | ||
| for i, mnt := range rootMnts { |
Contributor
There was a problem hiding this comment.
this for loop disappeared in the new version. Not exactly sure what it was trying to do and if you removed it deliberately.
Contributor
Author
There was a problem hiding this comment.
Yeah the loop is gone because it was unnecessary. We can just mount the rootfs and then tell runc to use a subdir of that mount rather than reset the source of each mount (which is now handled above on line 405)
tiborvass
approved these changes
Dec 2, 2025
alexcb
approved these changes
Dec 2, 2025
Collaborator
alexcb
left a comment
There was a problem hiding this comment.
looks cool! nice speedup!
raykao
pushed a commit
to raykao/dagger
that referenced
this pull request
Dec 9, 2025
* engine: optimize copies to use hardlinks when possible Signed-off-by: Erik Sipsma <erik@sipsma.dev> * cleanup TODOs Signed-off-by: Erik Sipsma <erik@sipsma.dev> * add integ tests Signed-off-by: Erik Sipsma <erik@sipsma.dev> * changelog Signed-off-by: Erik Sipsma <erik@sipsma.dev> --------- Signed-off-by: Erik Sipsma <erik@sipsma.dev>
raykao
pushed a commit
to raykao/dagger
that referenced
this pull request
Dec 14, 2025
* engine: optimize copies to use hardlinks when possible Signed-off-by: Erik Sipsma <erik@sipsma.dev> * cleanup TODOs Signed-off-by: Erik Sipsma <erik@sipsma.dev> * add integ tests Signed-off-by: Erik Sipsma <erik@sipsma.dev> * changelog Signed-off-by: Erik Sipsma <erik@sipsma.dev> --------- Signed-off-by: Erik Sipsma <erik@sipsma.dev>
tiborvass
added a commit
to tiborvass/dagger
that referenced
this pull request
Jan 7, 2026
Commit 52cd3ce from PR dagger#11497 regressed cross compilation. This commit fixes it. Signed-off-by: Tibor Vass <teabee89@gmail.com>
tiborvass
added a commit
to tiborvass/dagger
that referenced
this pull request
Jan 7, 2026
Commit 52cd3ce from PR dagger#11497 regressed cross compilation. This commit fixes it. Signed-off-by: Tibor Vass <teabee89@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Realized while talking to a user about disk usage problems that thanks to various forward progress on the Theseus front this has become some very low-hanging fruit for optimization.
Before this a
WithDirectoryoperation could under very specific circumstances useMergeOp, which attempts to use hardlinks in its implementation in order to skip copies of files and thus save disk space and time.This change greatly expands the circumstances in which that hardlink optimization is possible. It will essentially always be used now except for the cases where an owner/permission or other metadata is being modified during the copy.
Results so far:
engine-dev container sync) consumes 1.7GB less spaceTestModulestakes 2.1GB less space