Replace 9p mounts with virtiofs for vfkit and krunkit. Testing shows
that virtiofs mount is 23 times faster with krunkit, and 8 times faster
with vfkit.
vfkit and krunkit support multiple virtiofs mounts but minikube
--mount-* flags are not ready for multiple mounts. We have the same
issue with KIC drivers, supporting multiple mounts but using only one.
We hope to improve this in the next release.
Example usage:
minikube start --mount-string ~/models:/mnt/models
The arguments are parsed and validated when configuring the driver, so
invalid arguments fail quickly without starting the driver. The
validated mounts are stored in the machine config:
$ jq '.Driver.VirtiofsMounts' < ~/.minikube/machines/minikube/config.json
[
{
"HostPath": "/Users/joe/models",
"GuestPath": "/mnt/models",
"Tag": "f845b54d-00e3-493d-9541-3b37490b96db"
}
]
Minikube generates a new random UUID for every virtiofs mount to
identify the file system inside the guest. In krunkit and vfkit, every
mount is add as:
--device virtio-fs,sharedDir=/host-path,mountTag=f845b54d-00e3-493d-9541-3b37490b96db
When the guest is started the shared directory is mounted via SSH using:
sudo mkdir -p /mnt/models
sudo mount -t virtiofs f845b54d-00e3-493d-9541-3b37490b96db /mnt/models
Example mount:
$ minikube ssh findmnt /mnt/models
TARGET SOURCE FSTYPE OPTIONS
/mnt/models f845b54d-00e3-493d-9541-3b37490b96db virtiofs rw,relatime
More work is needed to add VirtioFS to qemu. I'm starting with vfkit and
krunkit since they have identical interface (krunkit was designed as
drop-in replacement for vfkit).