How to modify an instance

See also: Instance

This document shows further ways to customize an instance outside of the launch command, via settings.

Contents:

Set the status of an instance to primary

See also: client.primary-name

This section demonstrates how to set the status of an instance to primary. This is convenient because it makes this instance the default argument for several commands, such as shell , start , stop , restart , and suspend and also automatically mounts our $HOME directory in the instance.

To grant a regular instance the primary status, assign its name to the client.primary-name:

$ multipass set client.primary-name=<instance name>

This setting allows transferring primary status among instances. The primary name can be configured independently of whether instances with the old and new names exist. If they do, they lose and gain primary status accordingly.

This provides a means of (de)selecting an existing instance as primary. An example is show below:

# Assign the primary status to an instance called 'first':
$ multipass set client.primary-name=first
# Now this instance is picked up automatically by 'multipass start'
# The primary instance also automatically mounts the user's home directory into a directory called 'Home'
$ multipass start
Launched: first
Mounted '/home/ubuntu' into 'first:Home'
# Stop the primary instance
$ multipass stop
$ multipass launch --name second
Launched: second
# Change the primary instance to an existing instance
$ multipass set client.primary-name=second
# Now this instance is used by default by the commands
$ multipass suspend
# When listing all instances, the primary one is displayed first
$ multipass list
Name                    State             IPv4             Image
second                  Suspended         --               Ubuntu 18.04 LTS
first                   Stopped           --               Ubuntu 18.04 LTS

Set the CPU, RAM or disk of an instance (preview)

See also: local.<instance-name>.(cpus|disk|memory)

[since version 1.10]

While instance properties can be determined at launch, some of them can be updated after the instance has been created. Specifically, an instance’s memory, disk space, and the number of its CPUs are exposed via daemon settings: local.<instance-name>.(cpus|disk|memory).

Only properties of stopped, non-deleted instances can be updated, but all instances can have their properties fetched. Settings keys are therefore available for all Multipass-managed instances at that instant. Yet, trying to update an instance that is running, suspended, or deleted, results in an error.

We would like to allow modifying running instances, with changes being applied on the following restart, but that will come only at a later time. Live/hot modifications – changing the properties of running instances without a restart – is not in our plans (at least for current properties). It would seldom be supported by the hypervisors Multipass supports, and add little gain.

3 Likes

I am running multipass 1.9.0 on Mac book Pro with Apple silicone.

Trying to update disk size and getting this error :

multipass set local.superior-chihuahua.disk=20G
set failed: Unrecognized settings key: ‘local.superior-chihuahua.disk’

Hi @garichd!

Sorry for the confusion. This document did not specify the Multipass version this will be in. It will be in the upcoming version 1.10 and is available only as a preview on Linux.

I’ve updated the documented to reflect this fact.

1 Like

Thanks for the reply @townsend
is there anyway I can use this feature earlier with specific patch , I noticed that this was released back in 2021 under build #2353, However I am not sure the way to get that build installed.!

My VM was installed with default settings and I am now running out of space, Its configured heavily and to redo the work will set me back weeks…! :frowning:

Hi @garichd,

It was actually merged into the main branch on April 22.

If you are brave adventurous enough, you can get an unsigned-but-built-by-ci package from https://multipass-ci.s3.amazonaws.com/ci3606/multipass-1.10.0-dev.607.ci3606%2Bg7799cf6d.mac-Darwin.pkg that has this feature. I don’t anticipate you having any major regressions with this development package, but of course it can happen.

2 Likes