Multipass Command Examples – Create and Manage Ubuntu Virtual Machines

By | May 30, 2023

Multipass is a lightweight, command-line virtualization tool developed by Canonical that allows you to create and manage Ubuntu virtual machines (VM) on your local machine. It lets you run multiple isolated instances of Ubuntu for development and testing.

Multipass is cross-platform, which means you can run it on macOS, Windows, and Linux. However, on Linux, Multipass uses the Kernel-based Virtual Machine (KVM) for virtualization, which ensures it has an overall minimal overhead.

In this article, we'll discuss in detail the different commands you need to create to manage your Multipass virtual machines on Linux successfully. Our host system is running Ubuntu 23.04

Benefits of Multipass

Multipass offers several benefits, which separate it from other virtualization tools. Some of its key advantages are:

  • Quick setup and lightweight: Multipass abstracts the process of downloading, configuring, and launching virtual machines, allowing you to focus on your work.
  • Isolated virtual environments: Each virtual machine Multipass creates is self-contained, which allows you to avoid conflicts between different projects and protect your host machine from mishaps.
  • Cloud-init support: Multipass supports Cloud-init, which is the standard method of configuring cloud instances.
  • Cross-platform: Multipass can be used across different operating systems, including macOS, Windows, and Linux.

Overall, Multipass simplifies the process of working with virtual machines, providing a flexible and efficient virtualization tool.

How to Install Multipass

Multipass is available as a Snap package, which means you can install it on any Linux operating system with Snapd. By default, Snapd comes preinstalled on Ubuntu 18.04 and above.

Nonetheless, you can check whether Snapd is available on your machine, by executing:

snap version

However, if it isn't present on your machine, you can follow these instructions to install it.

After verifying that you have Snapd installed, run the following command to install Multipass:

$ sudo snap install multipass
multipass 1.11.0 from Canonical** installed

You can print the version information like this:

$ multipass version
multipass   1.11.0
multipassd  1.11.0

After installation, you should verify that Multipass has given your group write access to its socket, so you can interact with Multipass without the need to run sudo commands. To that end, you should execute the following command:

ls -l  /var/snap/multipass/common/multipass_socket
$ ls -l  /var/snap/multipass/common/multipass_socket
srw-rw---- 1 root sudo 0 May 29 15:01 /var/snap/multipass/common/multipass_socket

The output above indicates that the "root" user and "sudo" group have read and write permissions for the multipass_socket file.

1. List Available Images

To explore the available images that can be used to create instances with Multipass, run the following command:

multipass find

After executing the command above, Multipass obtains the list of available images and displays it as shown below:

$ multipass find
Image                       Aliases           Version          Description
snapcraft:core18            18.04             20201111         Snapcraft builder for Core 18
snapcraft:core20            20.04             20210921         Snapcraft builder for Core 20
snapcraft:core22            22.04             20220426         Snapcraft builder for Core 22
snapcraft:devel                               20230528         Snapcraft builder for the devel series
core                        core16            20200818         Ubuntu Core 16
core18                                        20211124         Ubuntu Core 18
core20                                        20230119         Ubuntu Core 20
core22                                        20230119         Ubuntu Core 22
18.04                       bionic            20230525         Ubuntu 18.04 LTS
20.04                       focal             20230523         Ubuntu 20.04 LTS
22.04                       jammy,lts         20230518         Ubuntu 22.04 LTS
22.10                       kinetic           20230524         Ubuntu 22.10
23.04                       lunar             20230502         Ubuntu 23.04
appliance:adguard-home                        20200812         Ubuntu AdGuard Home Appliance
appliance:mosquitto                           20200812         Ubuntu Mosquitto Appliance
appliance:nextcloud                           20200812         Ubuntu Nextcloud Appliance
appliance:openhab                             20200812         Ubuntu openHAB Home Appliance
appliance:plexmediaserver                     20200812         Ubuntu Plex Media Server Appliance
anbox-cloud-appliance                         latest           Anbox Cloud Appliance
charm-dev                                     latest           A development and testing environment for charmers
docker                                        0.4              A Docker environment with Portainer and related tools
jellyfin                                      latest           Jellyfin is a Free Software Media System that puts you in control of managing and streaming your media.
minikube                                      latest           minikube is local Kubernetes
ros-noetic                                    0.1              A development and testing environment for ROS Noetic.
ros2-humble                                   0.1              A development and testing environment for ROS 2 Humble.

The output above shows that the remote images available include Snapcraft builders, Ubuntu Core, and Ubuntu LTS (Long-Term support).

In addition, you can look up a specific image by including the image name in the "find" command, as shown in the example below.

$ multipass find 18.04
Image                       Aliases           Version          Description
18.04                                         20230525         Ubuntu 18.04 LTS
daily:18.04                                   20230525         Ubuntu 18.04 LTS

2. Launch a VM Instance

To create a new VM instance, run the following command:

multipass launch

On executing this command, Multipass will download a default image and launch a VM instance, with some basic default configuration, giving it a randomly generated name. Downloading can take some time depending on your internet speed.

Sample output:

Launched: affecting-shark

However, when creating an instance, you also have the option to use a specific image by adding the image's name to the command, as illustrated below:

multipass launch 18.04

Furthermore, you can enable logs, which provide detailed information about the processes going on in the background, as Multipass tries to download and launch an instance. This is particularly useful when troubleshooting.

To enable logging, add the "-v" option to the command. In addition, you can increase the verbosity of the output produced by adding more "v", up to four "v", as shown below:

multipass launch 18.04 -vvvv

Sample output:

[2023-05-20T07:31:59.677] [debug] [qemu-system-x86_64] [3619] started: qemu-system-x86_64 -nographic -dump-vmstate /tmp/multipassd.TkdrsS
[2023-05-20T07:31:59.989] [debug] [daemon] Applied AppArmor policy: multipass.executive-sandfish.qemu-system-x86_64
[2023-05-20T07:31:59.989] [info] [executive-sandfish] process state changed to Starting
[2023-05-20T07:31:59.996] [info] [executive-sandfish] process state changed to Running
[2023-05-20T07:31:59.996] [debug] [qemu-system-x86_64] [3624] started: qemu-system-x86_64 -bios OVMF.fd --enable-kvm -cpu host -nic tap,ifname=tap-2b54b832d18,script=no,downscript=no,model=virtio-net-pci,mac=52:54:00:69:80:02 -device virtio-scsi-pci,id=scsi0 -drive file=/var/snap/multipass/common/data/multipassd/vault/instances/executive-sandfish/ubuntu-18.04-server-cloudimg-amd64.img,if=none,format=qcow2,discard=unmap,id=hda -device scsi-hd,drive=hda,bus=scsi0.0 -smp 1 -m 1024M -qmp stdio -chardev null,id=char0 -serial chardev:char0 -nographic -cdrom /var/snap/multipass/common/data/multipassd/vault/instances/executive-sandfish/cloud-init-config.iso
[2023-05-20T07:31:59.997] [info] [executive-sandfish] process started 
Launched: executive-sandfish                                                    
[2023-05-20T07:33:11.827] [debug] [daemon] Returning setting local.privileged-mounts=true

Here is another example launching ubuntu 22.10 with verbose messages on the command line

silver@ubuntussd:~$ multipass launch 22.10 -vvv
[2023-05-30T12:55:55.306] [debug] [qemu-system-x86_64] [4594] started: qemu-system-x86_64 --version
[2023-05-30T12:57:23.956] [debug] [daemon] Applied AppArmor policy: multipass.qemu-img
[2023-05-30T12:57:23.960] [debug] [qemu-img] [4814] started: qemu-img info --output=json /var/snap/multipass/common/cache/multipassd/vault/images/kinetic-20230524/ubuntu-22.10-server-cloudimg-amd64.img
[2023-05-30T12:57:24.350] [debug] [daemon] Applied AppArmor policy: multipass.qemu-img
[2023-05-30T12:57:24.352] [debug] [qemu-img] [4823] started: qemu-img info /var/snap/multipass/common/cache/multipassd/vault/images/kinetic-20230524/ubuntu-22.10-server-cloudimg-amd64.img
[2023-05-30T12:57:24.387] [debug] [daemon] Applied AppArmor policy: multipass.qemu-img
[2023-05-30T12:57:24.388] [debug] [qemu-img] [4833] started: qemu-img resize /var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/ubuntu-22.10-server-cloudimg-amd64.img 5368709120
[2023-05-30T12:57:27.175] [debug] [qemu-img] [4840] started: qemu-img snapshot -l /var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/ubuntu-22.10-server-cloudimg-amd64.img
[2023-05-30T12:57:27.236] [debug] [romantic-rodent] process working dir '/snap/multipass/8465/qemu'
[2023-05-30T12:57:27.236] [info] [romantic-rodent] process program 'qemu-system-x86_64'
[2023-05-30T12:57:27.236] [info] [romantic-rodent] process arguments '-bios, OVMF.fd, --enable-kvm, -cpu, host, -nic, tap,ifname=tap-cf2818956a7,script=no,downscript=no,model=virtio-net-pci,mac=52:54:00:d4:87:8a, -device, virtio-scsi-pci,id=scsi0, -drive, file=/var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/ubuntu-22.10-server-cloudimg-amd64.img,if=none,format=qcow2,discard=unmap,id=hda, -device, scsi-hd,drive=hda,bus=scsi0.0, -smp, 1, -m, 1024M, -qmp, stdio, -chardev, null,id=char0, -serial, chardev:char0, -nographic, -cdrom, /var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/cloud-init-config.iso'
[2023-05-30T12:57:27.238] [debug] [qemu-system-x86_64] [4859] started: qemu-system-x86_64 -nographic -dump-vmstate /tmp/multipassd.iQVqfR
[2023-05-30T12:57:27.254] [debug] [daemon] Applied AppArmor policy: multipass.romantic-rodent.qemu-system-x86_64
[2023-05-30T12:57:27.254] [info] [romantic-rodent] process state changed to Starting
[2023-05-30T12:57:27.255] [info] [romantic-rodent] process state changed to Running
[2023-05-30T12:57:27.256] [debug] [qemu-system-x86_64] [4876] started: qemu-system-x86_64 -bios OVMF.fd --enable-kvm -cpu host -nic tap,ifname=tap-cf2818956a7,script=no,downscript=no,model=virtio-net-pci,mac=52:54:00:d4:87:8a -device virtio-scsi-pci,id=scsi0 -drive file=/var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/ubuntu-22.10-server-cloudimg-amd64.img,if=none,format=qcow2,discard=unmap,id=hda -device scsi-hd,drive=hda,bus=scsi0.0 -smp 1 -m 1024M -qmp stdio -chardev null,id=char0 -serial chardev:char0 -nographic -cdrom /var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/cloud-init-config.iso
[2023-05-30T12:57:27.256] [info] [romantic-rodent] process started              
Launched: romantic-rodent                                                       
[2023-05-30T12:57:51.563] [debug] [daemon] Returning setting local.privileged-mounts=true

If you read the verbose message carefully you will note that multipass is using qemu/kvm in the background to actually create and launch ubuntu virtual machines. The specific command in the above case looks something like this:

qemu-system-x86_64 -bios OVMF.fd --enable-kvm -cpu host -nic tap,ifname=tap-cf2818956a7,script=no,downscript=no,model=virtio-net-pci,mac=52:54:00:d4:87:8a -device virtio-scsi-pci,id=scsi0 -drive file=/var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/ubuntu-22.10-server-cloudimg-amd64.img,if=none,format=qcow2,discard=unmap,id=hda -device scsi-hd,drive=hda,bus=scsi0.0 -smp 1 -m 1024M -qmp stdio -chardev null,id=char0 -serial chardev:char0 -nographic -cdrom /var/snap/multipass/common/data/multipassd/vault/instances/romantic-rodent/cloud-init-config.iso

We can directly use Qemu to launch ubuntu virtual machines ourselves, but multipass makes it easier, so that we do not have to worry about lots of command line options and pass them correctly. Check out our previous posts on Qemu:

How to Boot Ubuntu 23.04 Live ISO with Qemu/KVM on Ubuntu Host
How to install Ubuntu 23.04 in Qemu/KVM on Ubuntu Host

2. Open a shell to the virtual machine

After you have launched a virtual machine running ubuntu, its time to connect to it via some kind of shell. Just like you would connect to a remote server via ssh.

The "multipass shell" command is used to launch the shell prompt of a specific instance, which allows you to execute commands directly on the instance. As noted previously, this command will open the shell prompt of the primary instance if an instance's name isn't indicated.

To open the shell prompt of an instance named "romantic-rodent" from the previous step, run the following command:

multipass shell romantic-rodent

Sample output:

silver@ubuntussd:~$ multipass shell romantic-rodent 
Welcome to Ubuntu 22.10 (GNU/Linux 5.19.0-42-generic x86_64)

 * Documentation:
 * Management:
 * Support:

  System information as of Tue May 30 13:04:22 IST 2023

  System load:  0.0               Processes:             91
  Usage of /:   32.8% of 4.67GB   Users logged in:       0
  Memory usage: 21%               IPv4 address for ens3:
  Swap usage:   0%

1 update can be applied immediately.
1 of these updates is a standard security update.
To see these additional updates run: apt list --upgradable

New release '23.04' available.
Run 'do-release-upgrade' to upgrade to it.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@romantic-rodent:~$ uname -a
Linux romantic-rodent 5.19.0-42-generic #43-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 18:21:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@romantic-rodent:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.10
Release:        22.10
Codename:       kinetic

Note that we were able to run the commands uname -a and lsb_release -a. Its a complete ubuntu command line where you can run any command like you would run on a normal ubuntu installation.

After the shell prompt is launched, you can execute any Linux command as you normally would on the instance. Conversely, enter "exit" in the shell prompt to return to your host machine.

Run commands without shell: With the exec command, Multipass also allows you to execute a command on a VM without having to launch the VM's shell. The example below demonstrates how to use the "exec" command to view the memory usage of an instance by telling Multipass to execute the "free" command on the instance.

multipass exec romantic-rodent -- free

In the command above, the instance's name is passed as the first argument to the "exec" command, while the two hyphens (--) separate the "exec" command from the actual instance's command, which in this case is "free".

Sample output:

$ multipass exec romantic-rodent -- free
               total        used        free      shared  buff/cache   available
Mem:          988520      177268      467176         956      344076      663960
Swap:              0           0           0

3. Create Instance with custom parameters

So far, we've used the default Multipass configuration when launching new instances. However, Multipass grants the flexibility of customizing resources allocated to a VM, including the name assigned to the VM.

Multipass allows the customization of different resources, including:

  • CPU: Multipass provides the "--cpu" or "-c" options, which allow you to set the number of CPUs for an instance. This value defaults to 1 if not specified.
  • Disk space: The "--disk" or "-d" options are used when allocating disk space to an instance. Generally, the value for the disk space is a positive integer expressed in bytes or with a K (kilobytes), M (megabytes), or G (gigabytes) suffix. However, the minimum value acceptable is 512M and will default to 5G if a value is not specified.
  • Memory: Multipass offers the "--memory" or "-m" options to set the amount of memory available for an instance. These options accept a positive integer or decimal number expressed either in bytes or with a K, M, or, G suffix. In any case, the minimum acceptable value is 128M and will default to 1G if this option is omitted.
  • Name: The "--name" or "-n" options are used to give an instance a name.

To tailor an instance to your desired configuration, add the appropriate options to the "multipass launch" command and specify your desired values. For example, to create a VM with 4 cores, 8G of memory, and 10G disk space, named "foo", the following command can be executed:

multipass launch 18.04   -c  4   -m 8G   -d 10G  -n "foo"   -vvv

Sample output:

[2023-05-20T08:52:39.709] [info] [foo] process state changed to Starting        
[2023-05-20T08:52:39.716] [info] [foo] process state changed to Running         
[2023-05-20T08:52:39.938] [debug] [qemu-system-x86_64] [4795] started: qemu-system-x86_64 -bios OVMF.fd --enable-kvm -cpu host -nic tap,ifname=tap-85a8e535edf,script=no,downscript=no,model=virtio-net-pci,mac=52:54:00:79:1e:e7 -device virtio-scsi-pci,id=scsi0 -drive file=/var/snap/multipass/common/data/multipassd/vault/instances/foo/ubuntu-18.04-server-cloudimg-amd64.img,if=none,format=qcow2,discard=unmap,id=hda -device scsi-hd,drive=hda,bus=scsi0.0 -smp 4 -m 8192M -qmp stdio -chardev null,id=char0 -serial chardev:char0 -nographic -cdrom /var/snap/multipass/common/data/multipassd/vault/instances/foo/cloud-init-config.iso
[2023-05-20T08:52:39.939] [info] [foo] process started                          
Launched: foo                                                                   
[2023-05-20T08:53:45.399] [debug] [daemon] Returning setting local.privileged-mounts=true

4. List Available Instances

To keep track of your VM instances and their current state, run the "multipass list" command. This command will display a list of all the instances you've previously created.

multipass list

Sample output:

Name                    State             IPv4             Image
affecting-shark         Running    Ubuntu 22.04 LTS
correct-longspur        Running    Ubuntu 22.04 LTS
executive-sandfish      Running     Ubuntu 18.04 LTS
primary-pipit           Stopped           --               Ubuntu 22.04 LTS

From the output produced, you can observe that the output provides information on the available instances, including their names, current state, IP address, and associated image.

List Image data in Json format

Additionally, Multipass supports displaying the list in other formats, including JSON, CSV, and YAML. This is achieved by adding the "--format" option to the "list" command and specifying the appropriate value. For example, to show the list in JSON format, run:

multipass list --format JSON

Sample output:

    "list": [
            "ipv4": [
            "name": "executive-sandfish",
            "release": "Ubuntu 18.04 LTS",
            "state": "Running"
            "ipv4": [
            "name": "affecting-shark",
            "release": "Ubuntu 22.04 LTS",
            "state": "Running"
            "ipv4": [
            "name": "correct-longspur",
            "release": "Ubuntu 22.04 LTS",
            "state": "Running"
            "ipv4": [
            "name": "primary-pipit",
            "release": "Ubuntu 22.04 LTS",
            "state": "Stopped"

The above kind of output is useful if you need to manage the instances programatically through automation of some kind.

5. View Instance Information

The "multipass info" command offers detailed information about a specific instance, including disk usage, memory usage, current state, IP address, and load. This is particularly useful for monitoring the resources used by individual VMs.

To obtain information about an instance, add the instance name as an argument to the "multipass info" command as shown in the example below:

multipass info foo

Sample output:

Name:               foo
State:                Running
Release:              Ubuntu 18.04.6 LTS
Image hash:        1975f68897bb (Ubuntu 18.04 LTS)
CPU(s):               4
Load:                   0.10 0.15 0.07
Disk usage:         1.2GiB out of 9.5GiB
Memory usage:   110.4MiB out of 7.8GiB
Mounts:         --

Alternatively, use the "--all" option to view detailed information for all the available instances.

multipass info --all

Additionally, similar to the list command, you have the option of presenting this information in other formats, using the "--format" option, as shown in the example below:

multipass info --all --format json

Here is another example:

$ multipass info romantic-rodent
Name:           romantic-rodent
State:          Running
Release:        Ubuntu 22.10
Image hash:     784c67d61181 (Ubuntu 22.10)
CPU(s):         1
Load:           0.00 0.02 0.00
Disk usage:     1.5GiB out of 4.7GiB
Memory usage:   174.4MiB out of 965.4MiB
Mounts:         --

6. Modify an Instance

If after creating an instance, you realize that some of the properties you defined do not fit your needs, you can alter these properties using the "multipass set" command. However, properties that you can modify are limited to the CPU, memory, and disk size.

Before modifying an instance, you first need to stop the instance. The "stop" command is used to stop an instance by passing it in the instance's name as shown in the following example:

multipass stop foo

After stopping the instance, invoke the "set" command together with the name and new value of the property that you want to update using the following syntax: "". For example, to change the disk size of the "foo" instance to 200G, run:

multipass set

Similarly, to change the number of CPUs and memory to 3 and 16G respectively, run:

multipass set
multipass set

7. Set a Primary Instance

In Multipass, a primary instance refers to the default VM instance that is triggered when the commands — shell, start, stop, restart, and suspend are executed without specifying an instance name. In addition, the home directory of the host computer is usually mounted under the "Home" directory of the primary instance, which allows you to seamlessly share files between your host machine and the VM.

Generally, the primary instance is created automatically when you invoke the aforementioned commands if one doesn't exist. However, Multipass provides a way to set previously created instances as the primary instance.

To configure a specific instance as the primary instance, run the following command, replacing "foo" with the name of the instance to be set as the primary:

multipass set client.primary-name=foo

After executing the command, subsequent calls to the commands mentioned above will be performed on the configured primary instance.

8. Start, Stop, and Suspend an Instance

A VM instance can be in a running, stopped, suspended, or deleted state. The "start", "stop', and "suspend" commands can be used to change the state of a VM.

A VM in the suspended or stopped state can be started by running the following command, where "foo" is the VM name:

multipass start foo

Alternatively, you can launch multiple instances at the same time by passing two or more instance names to the start command.

multipass start foo affecting-shark correct-longspur

Additionally, you can start all the available instances by adding the "--all" option to the start command, as shown below:

multipass start --all

In the suspended state, Multipass preserves the state of the VM, which is then restored when the VM is started again.

To suspend an instance, invoke the "suspend" command, specifying the instance's name as shown below:

multipass suspend foo

Similar to the "start" command, you can suspend multiple instances at once by specifying two or more instance names.

multipass suspend foo affecting-shark correct-longspur

In the same way, you can suspend all running instances by adding the "--all" option to the suspend command.

multipass suspend --all

The "stop" command is used to terminate a running instance. For example, to stop an instance named "foo", run:

multipass stop foo

Similarly, to stop multiple instances at once, add two or more instance names as shown below:

multipass stop foo affecting-shark correct-longspur

In addition, the "--all" option can be used to stop all running instances.

multipass stop --all

9. How to Use a Command Alias

Multipass supports the use of aliases, which are shortcuts for commands that can be executed in an instance. Multipass provides the "alias" command for creating aliases.

The following syntax is used when creating an alias:

multipass alias instance-name:command  alias-name

For example, the following command creates an alias of the "df" command named "fstore" for the "foo" instance:

multipass alias foo:df  fstore

After creating the alias, the alias can be invoked by running:

multipass fstore

Executing the alias will produce a similar output to the one below, which displays information about available disks and filesystems.

Filesystem     1K-blocks    Used Available Use% Mounted on
udev             3036832       0   3036832   0% /dev
tmpfs             609952     632    609320   1% /run
/dev/sda1      203056560 1431280 201608896   1% /
tmpfs            3049752       0   3049752   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs            3049752       0   3049752   0% /sys/fs/cgroup
/dev/sda15        106858    5336    101522   5% /boot/efi
tmpfs             609948       0    609948   0% /run/user/1000

In addition, Multipass provides a way to add options for aliases. To achieve this, two hyphens (--) are used to separate the alias part of the command from the options as shown below:

multipass fstore --  -h

In the command above, the "-h" option is added to the "fstore" alias, which displays the storage metrics of the underlying "df" command in a human-readable format.

To view all the aliases that you have created, run:

multipass aliases

Sample output:

Alias   Instance          Command  Working directory
aflist       affecting-shark     ls              map
clfree      correct-longspur  free           map
cllist        correct-longspur  ls              map
ffe           foo                       free           map
fstore      foo                       df              map

The output produced shows information about the available aliases, their corresponding commands, the instance they run on, and their working directory mapping.

Conversely, the "unalias" command is used to remove previously defined alias. The "unalias" command takes a name argument of the alias to be removed.

For example, running the following command will remove the "ffe" alias:

multipass unalias ffe

Alternatively, you can remove multiple aliases at once by passing two or more aliases to the "unalias" command, as shown below:

multipass unalias aflist clfree cllist

In addition, the "--all" option can be added to the "unalias" command to remove all defined aliases.

multipass unalias --all

10. Share Data with an Instance

Data can be shared between the host machine and the VM instance in two ways — via mount and transfer.

The Mount Method

The mount method, which is the recommended way of sharing data involves mounting a directory of the host machine into a specific directory within the VM with the help of the "mount" command.

In general, the "mount" command uses the following syntax:

multipass mount   /host/directory   instance-name:/instance/destination/directory

For instance, let's say we have a directory "/home/foo/bar" on the host machine, and we want to mount it in a VM named "my-vm" at the path "/home/ubuntu/example". The following command can be used to achieve this:

multipass   mount   /home/foo/bar   my-vm:/home/ubuntu/example

After executing the command above, the directory "/home/foo/bar" will be accessible within the "my-vm" instance at the path "/home/ubuntu/example". Hence, any changes made to files and directories at this mount point will reflect on the host machine and vice versa.

Moreover, you can create as many mount points as needed for a VM. You can also view the mount points on a VM by executing the "multipass info" command on that instance.

multipass info my-vm

Sample output:

Name:           my-vm
State:          Running
Release:        Ubuntu 22.04.2 LTS
Image hash:     afb820a92602 (Ubuntu 22.04 LTS)
CPU(s):         1
Load:           0.00 0.15 0.13
Disk usage:     1.4GiB out of 4.7GiB
Memory usage:   173.6MiB out of 965.9MiB
Mounts:         /home/foo/bar => /home/ubuntu/example
                    UID map: 1000:default
                    GID map: 1000:default

On the other hand, the "umount" command is used to unmount a directory by specifying either the directory to be unmounted or only the instance's name, which ensures that all mount points on that instance are removed.

The following command shows how to unmount a specific directory:

multipass  umount  my-vm:/home/ubuntu/example

Alternatively, use the command below to remove all mount points on a VM.

multipass umount my-vm

The Transfer Method

Multipass provides the "transfer" command, which allows seamless copying of files between the host machine and the VM without the need to configure a mount point.

To copy a file from the host machine to the VM, run the following command:

multipass transfer example.txt my-vm:.

In the command above, the file "example.txt" is copied from the host machine to the home directory of the "my-vm" instance.

Alternatively, you can copy a file from a VM to the host machine as shown in the command below:

multipass transfer  my-vm:hello.txt   .

In addition, starting from Multipass version 1.11.0, you can also copy an entire directory by including the "--recursive" option in the "transfer" command.

To copy a directory named "foo" to a VM, run:

multipass transfer --recursive foo  my-vm:.

11. Remove an Instance

The "multipass delete" command can be used to get rid of unneeded VMs. However, this command does not remove the VM completely, as the deleted VM can be restored using the "recover" command. As a result, the "--purge" or "-p" options are usually included when you want to totally remove a VM.

To delete a VM that can be restored, run:

multipass delete vm-name

To permanently delete a VM, run the following command instead:

multipass delete  --purge  vm-name

In addition, you can delete all available instances by adding the "--all" option as shown below:

multipass delete --all
multipass delete --all  --purge


Multipass is a robust virtualization tool that simplifies the management and deployment of Ubuntu virtual machines. It offers several convenient commands, allowing you to configure and spin up VMs with ease.

Using Multipass, you can set up self-contained development environments for experimentation, testing, and deploying applications. However bear in mind that multipass is not the only tool to launch virtual machines. There are other solutions like qemu/kvm, vmware, xen etc. And if you do not need a full operating system for your use case you can run just the application inside a container like docker.

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

Leave a Reply

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