Sharing host directories inside the VM

Mount host folders into running VMs (Anka 3.9.0+)

Due to limitations in the way Apple allows us to mount host directories inside of the VM, we cannot guarantee that the host and guest will always have the same file contents.

Host ⇄ Guest shared folder sync limitations

OperationDirectionSupportedNotes
Create new file/folderHost → Guest✅ YesNew paths appear in the guest
Create new file/folderGuest → Host✅ YesNew paths appear on the host
Read existing contentsHost → Guest✅ YesContents present at mount time are visible
Modify file in placeGuest → Host✅ YesGuest edits are written through to the host
Modify file in placeHost → Guest❌ NoGuest keeps stale contents for already-accessed files (macOS virtiofs caching)
Delete file/folderGuest → Host✅ YesRemoval is reflected on the host
Delete file/folderHost → Guest❌ NoGuest still sees the path after the host deletes it (cached)
Replace via temp + rename() (atomic)Host → Guest✅ YesNew inode/dentry; recommended way to update files from the host

Why the host → guest gaps exist

  • The in-guest mount at /Volumes/My Shared Files is performed by macOS’s own automounter.
  • Apple’s Virtualization.framework exposes no API to tune virtiofs caching (attr_timeout, cache=, DAX), so the guest caches dentries/attributes and does not re-validate when the host changes an already-seen path.
  • This is a platform limitation, not specific to Anka — any tool built on Virtualization.framework behaves the same way.

Recommendation for users

  • Best practice: make changes inside the guest when you need them reflected on the host (fully bidirectional).
  • When changing files on the host, prefer creating new files or atomic replace (write to a temp file, then mv/rename() over the target) instead of editing in place, so the guest picks up the change.

Starting in 3.9.0, we’ve added support for sharing host directories as inside of the VM.

This is not currently supported on Intel.

High level

  • Supports multiple VMs mounting the same folder from host
  • Supports anka mount + anka unmount
  • Supports anka modify {vm} mount + anka modify delete mount so that you automatically mount the same location no matter what host is running the VM Template.
  • Survives VM reboots

Command line reference

> anka mount --help
usage: mount vmid [host_path[:guest_folder_name]]

   Mounts a host path to a running VM

arguments:
  vmid                     VM name or UUID
  host_path[:guest_folder_name]
                           Mount host_path and an optional guest_folder_name (which defaults to host_path folder name if not provided)
> anka unmount --help
usage: unmount [options] vmid [mount_ref...]

   Unmounts a host path from a running VM

arguments:
  vmid                     VM name or UUID
  mount_ref                Mount reference: fsid, guest_folder_name, or host_path to unmount

options:
  -a,--all                 Unmount all host paths from a running VM
> anka modify 15.6.1 mount --help
usage: mount host_path[:guest_folder_name]...

   Add a host path to the VM's mounts

arguments:
  host_path[:guest_folder_name]
                           Add host_path and an optional guest_folder_name (which defaults to host_path folder name) to template config
> anka modify 15.6.1 delete mount --help
usage: mount [options] [mount_ref...]

   Remove host folder mount(s) from template config

arguments:
  mount_ref                Mount reference: host_path, guest_folder_name, or host_path[:guest_folder_name]

options:
  -a,--all                 Delete all mount definitions
> anka show 15.6.1 mount --help

Examples

The folders you mount are all available under /Volumes/My Shared Files in the VM. This is not something we can change and is enforced by Apple.
❯ anka run test bash -c "ls -alht /Volumes/"
total 0
drwxr-xr-x   4 root  wheel   128B May  4 08:59 .
lrwxr-xr-x   1 root  wheel     1B May  4 08:59 Macintosh HD -> /
drwxr-xr-x  22 root  wheel   704B Apr  6 01:10 ..
drwxr-xr-x   1 anka  staff     0B Dec 31  1969 My Shared Files

❯ anka run test bash -c "ls -alht /Volumes/My\ Shared\ Files/"
total 0
drwxr-xr-x  4 root  wheel   128B May  4 08:59 ..
drwxr-xr-x  1 anka  staff     0B Dec 31  1969 .

❯ anka mount test ~/
/Volumes/My Shared Files/nathanpierce

❯ anka run test bash -c "ls -alht /Volumes/My\ Shared\ Files/"
total 16
drwxr-xr-x@ 245 anka  staff   7.7K May  4  2026 nathanpierce
drwxr-xr-x    4 root  wheel   128B May  4 08:59 ..
drwxr-xr-x    1 anka  staff     0B Dec 31  1969 .

❯ echo "hello" > ~/testfile1

❯ cat ~/testfile1
hello

❯ anka run test bash -c "cat /Volumes/My\ Shared\ Files/nathanpierce/testfile1"
hello

You can see what folders are mounted with:

❯ anka mount test
+------+---------------------+-------------------+---------------------------------------+
| fsid | host_path           | guest_folder_name | guest_path                            |
+------+---------------------+-------------------+---------------------------------------+
| 1    | /Users/nathanpierce | nathanpierce      | /Volumes/My Shared Files/nathanpierce |
+------+---------------------+-------------------+---------------------------------------+

❯ anka show test mount
+---------------------+---------------------------------------+
| host_path           | guest_path                            |
+---------------------+---------------------------------------+
| /Users/nathanpierce | /Volumes/My Shared Files/nathanpierce |
+---------------------+---------------------------------------+

You can disable the automounting of the volume that holds the folders in the VM globally in the host by changing anka config mount_prestart_automount_device to 0:

❯ anka config | grep automount
| mount_prestart_automount_device | 1