Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can someone explain the location attribute under mounts, how it works ? #3771

Unanswered
bdutta asked this question in Q&A
Discussion options

Relatively new to lima here. I use lima to run some Debian Linux dev VMs on MacOS, and few observations appear a bit confusing to my newbie eyes. Would be nice if someone could share some explanation. Let's say that my username on MacOS is "alan".

On the MacOS host, I have this folder: "/Users/alan/Work", which contains a few dev project I've worked on natively in MacOS. I've added a "vz" type Debian Linux VM on lima and when I login to this VM using limactl shell <vmname>, by default I am placed in "/Users/alan" folder inside the VM. If I do cd $HOME, it takes me to "/home/alan.linux" folder, which has the "Work" folder (same as "/Users/alan/Work" from the host). This is what is totally confusing me. I have some scripts that use $HOME, so the behaviour is throwing them off. And what is that folder where I landed when I logged in with limactl shell <vmname>.

The "lima.yaml" relevant section is:

mounts:
 - location: ~/work # Example: Mount your host's work directory
 writable: true
 - location: /tmp/lima
You must be logged in to vote

Replies: 2 comments 2 replies

Comment options

Lima attempts to be transparent to the user, which is why by default it mounts your host directory under the same path inside the VM. The result is that when you execute lima on the host, it shells into the corresponding path inside the guest.

In your case this means that /Users/alan/Work is mounted under /Users/alan/Work inside the VM.

If you want to override this, you can use the mountPoint attribute to specify the mount location:

mounts:
 - location: "~/work"
 mountPoint: "{{.Home}}/work"
 writable: true

P.S. You can find a lot of the missing docs in the default.yaml template.

You must be logged in to vote
1 reply
Comment options

Thank you, that does clarify a lot. Also thanks for the links.

Comment options

This should be covered in the documentation, "starting a couple of VMs" is not the most typical use case - but should be covered

It seems to mostly be about host home versus guest home?

You must be logged in to vote
1 reply
Comment options

Thank you. This is a lot clearer now. Would be good to be able to find this answer in docs or at least the FAQ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /