Change Multipass instance memory and CPU allocation after launch

Share this:

I started using Multipass recently to host and run Ubuntu server instances on my MacBook Pro. I also usually pre-define the amount of vCPUs and memory that is allocated to the instance when I launch it. However, the CLI does not provide a way to change the Multipass instance memory and CPU allocation once you have launched them. Not until this new feature is provided to us.

Changing Multipass instance memory and CPU allocation

Time Needed : 5 minutes

Tl;DR: Here is how you change the Multipass instance memory and CPU allocation

  1. Unload multipassd

    sudo launchctl unload /Library/LaunchDaemons/com.canonical.multipassd.plist

    Before changing the Multipass instance memory and CPU allocation

  2. Edit the multipassd-vm-instances.json file

    sudo vi /var/root/Library/Application\ Support/multipassd/multipassd-vm-instances.json

    Ubuntu Multipass multipassd-vm-instances.json file

  3. Reload multipassd:

    sudo launchctl load /Library/LaunchDaemons/com.canonical.multipassd.plist

    After changing the Multipass instance memory and CPU allocation

Tools
  • macOS Terminal app or iTerm2
  • vi
Materials
  • Ubuntu Multipass

The details of the steps for the uninitiated

To change the configuration of the Multipass instance, you have to do edit the multipassd-vm-instances.json config file.

But first you have to unload the multipassd service first. Otherwise, the configuration will not take hold. The following command will do that for you.

sudo launchctl unload /Library/LaunchDaemons/com.canonical.multipassd.plist

Once you’ve unloaded the multipassd service, you can now edit the multipassd-vm-instances.json file. On my Mac, it is located at /var/root/Library/Application Support/multipassd/.

sudo vi /var/root/Library/Application\ Support/multipassd/multipassd-vm-instances.json

You should see the configuration looking like the screenshot below.

Ubuntu Multipass multipassd-vm-instances.json file

Edit the mem_size or the num_cores as you require. Note that the mem_size is in bytes. Stating the obvious, doing this will change the Multipass instances memory and CPU allocation upon reload of the multipassd service.

Once done, load the the multipassd service again and you will be able to start the Multipass instance with the new memory and CPU configuration. The following command will do that for you.

sudo launchctl load /Library/LaunchDaemons/com.canonical.multipassd.plist

With that, you would have reconfigured the Multipass instances with a new memory and/or CPU allocation.

Before changing the Multipass instance memory and CPU allocation
After changing the Multipass instance memory and CPU allocation

Speaking of virtualisation, find out if you can actually play Windows games on a Mac machine using Parallels Desktop.

3DMark 11 Results when running on Windows 10 on Parallels Desktop


If this post has been useful, support me by buying me a latte or two 🙂
Buy Me A Coffee

Share this:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.