diff --git a/site/content/en/docs/handbook/mount.md b/site/content/en/docs/handbook/mount.md index a88f5e59fc..58de57760f 100644 --- a/site/content/en/docs/handbook/mount.md +++ b/site/content/en/docs/handbook/mount.md @@ -8,79 +8,88 @@ aliases: - /docs/tasks/mount --- -## 9P Mounts +## Mount During Start -9P mounts are flexible and work across all hypervisors, but suffers from performance and reliability issues when used with large folders (>600 files). See **Driver Mounts** as an alternative. +To mount a directory from the host into the guest using the `start` subcommand +use the `--mount-string` flag: + +```shell +minikube start --mount-string : +``` + +For example, this would mount your `~/models` directory to appear as +`/mnt/models` within the minikube VM. + +```shell +minikube start ~/models:/mnt/models +``` + +The directory remains mounted while the cluster is running. + +The mount will use the best method supported by the driver: + +| Driver | OS | Method | Notes | +|----------------|---------|------------------|------------------------| +| docker | Linux | container volume | | +| podman | Linux | container volume | | +| kvm | Linux | 9p | | +| Vfkit | macOS | virtiofs | Since minikube 1.37.0 | +| Krunkit | macOS | virtiofs | Since minikube 1.37.0 | +| qemu | macOS | 9p | | + +The `--mount-string` flag supports only a single mount. If you want to mount +additional directories, or mount and unmount directories after the cluster was +started see [Mount Command](#Mount-command). + +## Mount Command + +The mount command allows mounting and unmounting directories after the minikube +cluster was started using the *9p* filesystem. The command works with all VM +drivers. To mount a directory from the host into the guest using the `mount` subcommand: ```shell -minikube mount : +minikube mount : directory> ``` -For example, this would mount your home directory to appear as /host within the minikube VM: +For example, this would mount your `~/models` directory to appear as +`/mnt/models` within the minikube VM: ```shell -minikube mount $HOME:/host +minikube mount ~/models:/mnt/models ``` -This directory may then be referenced from a Kubernetes manifest, for example: +The directory remains mounted while the mount command is running. To unmount the +directory terminate the mount command with `Control+C`. -```shell -{ - "apiVersion": "v1", - "kind": "Pod", - "metadata": { - "name": "ubuntu" - }, - "spec": { - "containers": [ - { - "name": "ubuntu", - "image": "ubuntu:18.04", - "args": ["bash"], - "stdin": true, - "stdinOnce": true, - "tty": true, - "workingDir": "/host", - "volumeMounts": [ - { - "mountPath": "/host", - "name": "host-mount" - } - ] - } - ], - "volumes": [ - { - "name": "host-mount", - "hostPath": { - "path": "/host" - } - } - ] - } -} -``` +*9p* mounts are flexible and work across all hypervisors, but suffers from +performance and reliability issues when used with large folders (>600 files). +See [Driver Automatic Mounts](#driver-automatic-mounts) and +[Driver Specific Mounts](#driver-specific-mounts) as alternatives. -## Driver mounts +## Driver automatic mounts -Some hypervisors, have built-in host folder sharing. Driver mounts are reliable with good performance, but the paths are not predictable across operating systems or hypervisors: +Some hypervisors, have built-in host folder sharing. Driver mounts are reliable +with good performance, but the paths may differ across operating systems or +hypervisors: -| Driver | OS | HostFolder | VM | -| --- | --- | --- | --- | -| VirtualBox | Linux | /home | /hosthome | -| VirtualBox | macOS | /Users | /Users | -| VirtualBox | Windows | C://Users | /c/Users | -| VMware Fusion | macOS | /Users | /mnt/hgfs/Users | -| KVM | Linux | Unsupported | | -| HyperKit | macOS | Supported | | +| Driver | OS | Host | Guest | +|----------------|---------|--------------|-------------------| +| VirtualBox | Linux | /home | /hosthome | +| VirtualBox | macOS | /Users | /Users | +| VirtualBox | Windows | C://Users | /c/Users | +| VMware Fusion | macOS | /Users | /mnt/hgfs/Users | -These mounts can be disabled by passing `--disable-driver-mounts` to `minikube start`. +Built-in mounts can be disabled by passing the `--disable-driver-mounts` flag to +`minikube start`. -HyperKit mounts can use the following flags: -`--nfs-share=[]`: Local folders to share with Guest via NFS mounts -`--nfs-shares-root='/nfsshares'`: Where to root the NFS Shares, defaults to /nfsshares +## Driver Specific Mounts + +HyperKit driver can also use the following start flags: +- `--nfs-share=[]`: Local folders to share with Guest via NFS mounts +- `--nfs-shares-root='/nfsshares'`: Where to mount the NFS Shares, defaults to + `/nfsshares` ## File Sync