I use Lima for the virtual machine Trellis provisions. I see no config controlling what RAM and CPU is being set, so I presume Lima set a default when being created initially.
How would you normally modify the RAM and CPU of a Lima instance?
I tried manually editing my config file, but on a restart of the lima instance, that change was removed.
nano ~/.lima/mydomain.local/lima.yaml
I manually added:
cpus: 4
memory: "8GiB"
vmType: "vz"
cpus: 4
memory: "8GiB"
rosetta:
enabled: false
images:
- location: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
arch: x86_64
- location: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-arm64.img
arch: aarch64
......
Maybe you don’t edit the config file at all. I reprovisioned trellis too, no change.
That’s the correct file to edit, but I’m not sure "8GiB"
is the correct syntax. Maybe the quotes don’t matter, but if instead of manually editing that file, you issue limactl
commands, it does not add quotes when you check the file afterward.
limactl list
limactl edit <NAME> --memory 8
limactl edit <NAME> --cpus 8
Contents of end of ~/lima/<NAME>/lima.yaml
:
...
memory: 8GiB
cpus: 8
In any case, typing limactl edit <NAME> --
and pressing tab will bring up a list of the various things you can change, so you shouldn’t have to manually edit that lima.yaml
file.
And reprovisioning may or may not be necessary, but I believe trellis vm stop
before making these changes would be. And naturally trellis vm start
after.
Edit: if you do want to change the default for all your instances, you can edit ~/.lima/_config/default.yaml
. I do believe you have to edit that file rather than issuing any limactl
commands. You can see all the options you can add here: lima/templates/default.yaml at dd8a2e1d2042c1ec6402a8f944586d246c50d623 · lima-vm/lima · GitHub
1 Like
Thank you @ttamnedlog. Using the limactl edit <NAME> --
commands did the trick.
Heads up. Although the above command worked, it doesn’t do one step which trellis vm start
does which is to update the hosts file. Therefore I could not access my site.
For now, I used the limactl commands to start the machine, then manually updated my hosts file with what trellis vm start
would have added.
Is there a method to use trellis vm start
but tag on some values such as --cpu and --ram too?