|
| 1 | +# Filesystem mounts |
| 2 | + |
| 3 | +Lima supports several methods for mounting the host filesystem into the guest. |
| 4 | + |
| 5 | +The default mount type is shown in the following table: |
| 6 | + |
| 7 | +| Lima Version | Default | |
| 8 | +| ---------------- | ----------------------------------- | |
| 9 | +| < 0.10 | reverse-sshfs + Builtin SFTP server | |
| 10 | +| >= 0.10 | reverse-sshfs + OpenSSH SFTP server | |
| 11 | +| >= 1.0 (Planned) | 9p | |
| 12 | + |
| 13 | +## Mount types |
| 14 | + |
| 15 | +### reverse-sshfs |
| 16 | +The "reverse-sshfs" mount type exposes the host filesystem by running an SFTP server on the host. |
| 17 | +While the host works as an SFTP server, the host does not open any TCP port, |
| 18 | +as the host initiates an SSH connection into the guest and let the guest connect to the SFTP server via the stdin. |
| 19 | + |
| 20 | +An example configuration: |
| 21 | +```yaml |
| 22 | +mountType: "reverse-sshfs" |
| 23 | +mounts: |
| 24 | +- location: "~" |
| 25 | + sshfs: |
| 26 | + # Enabling the SSHFS cache will increase performance of the mounted filesystem, at |
| 27 | + # the cost of potentially not reflecting changes made on the host in a timely manner. |
| 28 | + # Warning: It looks like PHP filesystem access does not work correctly when |
| 29 | + # the cache is disabled. |
| 30 | + # 🟢 Builtin default: true |
| 31 | + cache: null |
| 32 | + # SSHFS has an optional flag called 'follow_symlinks'. This allows mounts |
| 33 | + # to be properly resolved in the guest os and allow for access to the |
| 34 | + # contents of the symlink. As a result, symlinked files & folders on the Host |
| 35 | + # system will look and feel like regular files directories in the Guest OS. |
| 36 | + # 🟢 Builtin default: false |
| 37 | + followSymlinks: null |
| 38 | + # SFTP driver, "builtin" or "openssh-sftp-server". "openssh-sftp-server" is recommended. |
| 39 | + # 🟢 Builtin default: "openssh-sftp-server" if OpenSSH SFTP Server binary is found, otherwise "builtin" |
| 40 | + sftpDriver: null |
| 41 | +``` |
| 42 | +
|
| 43 | +The default value of `sftpDriver` has been set to "openssh-sftp-server" since Lima v0.10, when an OpenSSH SFTP Server binary |
| 44 | +such as `/usr/libexec/sftp-server` is detected on the host. |
| 45 | +Lima prior to v0.10 had used "builtin" as the SFTP driver. |
| 46 | + |
| 47 | +#### Caveats |
| 48 | +- A mount is disabled when the SSH connection was shut down. |
| 49 | +- A compromised `sshfs` process in the guest may have an access to unexposed host directories. |
| 50 | + |
| 51 | +### 9p |
| 52 | +The "9p" mount type is implemented by using QEMU's virtio-9p-pci devices. |
| 53 | +virtio-9p-pci is also known as "virtfs", but note that this is unrelated to [virtio-fs](https://virtio-fs.gitlab.io/). |
| 54 | + |
| 55 | +An example configuration: |
| 56 | +```yaml |
| 57 | +mountType: "9p" |
| 58 | +mounts: |
| 59 | +- location: "~" |
| 60 | + 9p: |
| 61 | + # Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none". |
| 62 | + # 🟢 Builtin default: "mapped-xattr" |
| 63 | + securityModel: null |
| 64 | + # Select 9P protocol version. Valid options are: "9p2000" (legacy), "9p2000.u", "9p2000.L". |
| 65 | + # 🟢 Builtin default: "9p2000.L" |
| 66 | + protocolVersion: null |
| 67 | + # The number of bytes to use for 9p packet payload, where 4KiB is the absolute minimum. |
| 68 | + # 🟢 Builtin default: "128KiB" |
| 69 | + msize: null |
| 70 | + # Specifies a caching policy. Valid options are: "none", "loose", "fscache" and "mmap". |
| 71 | + # Try choosing "mmap" or "none" if you see a stability issue with the default "fscache". |
| 72 | + # See https://www.kernel.org/doc/Documentation/filesystems/9p.txt |
| 73 | + # 🟢 Builtin default: "fscache" for non-writable mounts, "mmap" for writable mounts |
| 74 | + cache: null |
| 75 | +``` |
| 76 | +#### Caveats |
| 77 | +- The "9p" mount type is known to be incompatible with CentOS, Rocky Linux, and AlmaLinux as their kernel do not support `CONFIG_NET_9P_VIRTIO`. |
0 commit comments