Add support for mounting a shared folder between the host and guest via virtiofs (v2) #93
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.
virtiofs, available in QEMU 5.2 or newer and Linux guests 5.4 or newer,
is a more modern way to pass local folders along to QEMU, as it takes
advantage of the fact that the folders are on the same machine as the
hypervisor.
To use virtiofs, we first need to find and run
virtiofsd
, which has twodifferent implementations: a C implementation included with QEMU up until
8.0 (available on most distros) and a standalone Rust implementation
available on GitLab (not packaged on many distros but easy to build and
install). Once we find it, we run it in the background and connect to it
using some QEMU parameters, which were shamelessly taken from the
official virtiofs website:
https://virtio-fs.gitlab.io/howto-qemu.html
To use it within the guest (you can use a different path than
/mnt/shared
butmount -t virtio shared
must be used):On the host:
This does require guest kernel support (
CONFIG_VIRTIO_FS=y
), otherwise it willnot work inside the guest; the script warns when there is a possibility this
configuration is not set so the user is not surprised by the following error:
Closes: #81
Link: https://gitlab.com/virtio-fs/virtiofsd