Skip to content

Conversation

@TatsuyaHayashino
Copy link
Contributor

Previously, mount tags were generated using index-based naming (mount0, mount1, etc.). This caused issues when mount configuration changed: the old mount remained active with its original path while the new fstab entry used the same tag for a different path. Users had to reboot twice to apply configuration changes.

This commit generates stable mount tags by hashing both the host location and guest mountPoint. This ensures:

  • Tags remain consistent across VM restarts regardless of mount order
  • Configuration changes take effect after a single reboot
  • Same host path mounted to multiple guest paths get unique tags

Fixes #3957

Previously, mount tags were generated using index-based naming (mount0,
mount1, etc.). This caused issues when mount configuration changed:
the old mount remained active with its original path while the new
fstab entry used the same tag for a different path. Users had to
reboot twice to apply configuration changes.

This commit generates stable mount tags by hashing both the host
location and guest mountPoint. This ensures:
- Tags remain consistent across VM restarts regardless of mount order
- Configuration changes take effect after a single reboot
- Same host path mounted to multiple guest paths get unique tags

Fixes lima-vm#3957

Signed-off-by: Tatsuya Hayashino <tatsuya.hayashino@gmail.com>
@TatsuyaHayashino
Copy link
Contributor Author

Tests result on MacOS

❯ ./_output/bin/limactl start -y
...

❯ lima sh -c 'cat /etc/fstab; mount' | grep Users
WARN[0000] treating lima version "3432a943" from "/Users/tatsuya/.lima/default/lima-version" as very latest release 
lima-1ea3a30cd79736ef   /Users/tatsuya  virtiofs        ro,nofail,comment=cloudconfig   0  0
lima-1ea3a30cd79736ef on /Users/tatsuya type virtiofs (ro,relatime)

❯ limactl stop
...

❯ limactl start --mount-only ~/git --mount-only ~/tmp
...
     
❯ lima sh -c 'cat /etc/fstab; mount' | grep Users
WARN[0000] treating lima version "3432a943" from "/Users/tatsuya/.lima/default/lima-version" as very latest release 
bash: line 1: cd: /Users/tatsuya/Development/lima: No such file or directory
mount0  /Users/tatsuya/git      virtiofs        ro,nofail,comment=cloudconfig   0       0
mount1  /Users/tatsuya/tmp      virtiofs        ro,nofail,comment=cloudconfig   0       0
mount0 on /Users/tatsuya/git type virtiofs (ro,relatime)
mount1 on /Users/tatsuya/tmp type virtiofs (ro,relatime)

@AkihiroSuda AkihiroSuda added this to the v2.1.0 milestone Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing existing mounts is brittle

2 participants