Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ require (
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/ulikunitz/xz v0.5.14 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/vbatts/tar-split v0.12.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1387,8 +1387,8 @@ github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0h
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.14 h1:uv/0Bq533iFdnMHZdRBTOlaNMdb1+ZxXIlHDZHIHcvg=
github.com/ulikunitz/xz v0.5.14/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
Expand Down
2 changes: 1 addition & 1 deletion hack/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ require (
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/ulikunitz/xz v0.5.14 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/vbatts/tar-split v0.12.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
Expand Down
4 changes: 2 additions & 2 deletions hack/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0h
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.14 h1:uv/0Bq533iFdnMHZdRBTOlaNMdb1+ZxXIlHDZHIHcvg=
github.com/ulikunitz/xz v0.5.14/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/vbatts/tar-split v0.12.1 h1:CqKoORW7BUWBe7UL/iqTVvkTBOF8UvOMKOIZykxnnbo=
Expand Down
119 changes: 64 additions & 55 deletions site/content/en/docs/handbook/mount.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

To mount a directory from the host into the guest using the `mount` subcommand:
```shell
minikube start --mount-string <host directory>:<guest directory>
```

For example, this would mount your `~/models` directory to appear as
`/mnt/models` within the minikube VM.

```shell
minikube mount <source directory>:<target directory>
minikube start ~/models:/mnt/models
```

For example, this would mount your home directory to appear as /host within the minikube VM:
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 $HOME:/host
minikube mount <host directory>:<guest> directory>
```

This directory may then be referenced from a Kubernetes manifest, for example:
For example, this would mount your `~/models` directory to appear as
`/mnt/models` within the minikube VM:

```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"
}
}
]
}
}
minikube mount ~/models:/mnt/models
```

## Driver mounts
The directory remains mounted while the mount command is running. To unmount the
directory terminate the mount command with `Control+C`.

*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 automatic mounts

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:

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:
| 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 |

| 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 | |
Built-in mounts can be disabled by passing the `--disable-driver-mounts` flag to
`minikube start`.

These mounts can be disabled by passing `--disable-driver-mounts` to `minikube start`.
## Driver Specific Mounts

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
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

Expand Down
Loading