Skip to content

Conversation

@JaewonHur
Copy link

This PR addresses #79 (Single file mount support).

It creates a temporary directory, and hardlink every mount requested file to that directory.
Then, it passthrough the directory (i.e., virtiofs) and bind mount the files under target paths.

Two points to clarify:

  • Are those lines in Source/ContainerizationOS/Mount/Mount.swift:149-153 intended? It creates a directory outside rootfs as it uses self.target.
  • Logging doesn't work in vmexec as stderr points /dev/null. We can fix it through files.append(stderr ?? FileHandle(fileDescriptor: 2, closeOnDealloc: false)) in Sources/ContainerizationOS/Command.swift.

Open problem:

  • After supporting file mount this way, I found that "after reading a mounted file from host side, reading the same file in guest returns permission error". It worked fine when writing to the file from host side. It seems there's some syncing issue in virtiofd daemon on hard linked files.

JaewonHur and others added 4 commits November 19, 2025 10:25
Create 'virtiofs' directory under container root and hardlink all mount
requested files to that directory. Then, feed that directory to Linux VM
through VirtIO device.
Mount shared file directory under bundlePath, and mount each file under
shared file directory to corresponding target path again.
Avoid conflict from same file name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant