Fix Docker volume mounts to enable hardlink optimization#3484
Merged
Conversation
PR #3388 added hardlink-based asset import/export (os.link with a shutil.copy2 fallback) to avoid duplicating disk space. The Dockerfile VOLUME instruction listed each /romm subdirectory (resources, library, assets, config, sync) separately, which makes Docker create an independent mount point for each one — even when the user bind-mounts a single parent at /romm. Each mount point is its own st_dev, so every cross-directory os.link() failed with EXDEV and silently fell back to a full copy, defeating the optimization. Declare the parent /romm directory instead so all subdirectories share a single filesystem and hardlinks can succeed when paths reside on the same underlying host filesystem.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Docker image’s declared volumes to avoid Docker creating separate mount points per /romm/* subdirectory, which was causing os.link() hardlink operations to fail with EXDEV during asset import/export.
Changes:
- Replace per-subdirectory
VOLUMEdeclarations with a single parentVOLUME ["/romm", "/redis-data"]to keep/romm/*on the same filesystem device when users bind-mount/romm.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
This change modifies the Docker
VOLUMEdeclaration to fix an issue where asset import/export hardlink optimization was failing due to cross-device link errors.Previously, the Dockerfile declared each subdirectory individually (
/romm/resources,/romm/library,/romm/assets,/romm/config,/romm/sync). When users bind-mounted a single parent directory at/romm, Docker would create separate mount points (each with its ownst_dev) for each subdirectory. This causedos.link()operations to fail withEXDEV("Cross-device link") errors, forcing the asset import/export process to fall back to slow full copies instead of using hardlinks.The fix declares only the parent
/rommdirectory (along with/redis-data) as volumes. This ensures all subdirectories remain on the same filesystem, allowing hardlink operations to succeed and enabling the hardlink optimization for asset import/export.Fixes #3483
Checklist
https://claude.ai/code/session_01STuknV2qjadTPHfSe5EV4q