Yes, you can create and manage snapshots of your Multipass VMs. Snapshots allow you to save the current state of a VM, which you can later restore to revert any changes made since the snapshot was taken. This is useful for testing, development, and other scenarios where you might want to revert to a known good state.

Here are the commands to manage snapshots in Multipass:

Creating a Snapshot

To create a snapshot of a running or stopped VM, use the multipass snapshot command:

multipass snapshot <vm-name> --name <snapshot-name>  

For example, to create a snapshot named “initial-state” of a VM named “test-vm”:

multipass snapshot test-vm --name initial-state  

Listing Snapshots

To list all snapshots for a specific VM, use the multipass info command:

multipass info <vm-name>  

This will display information about the VM, including its snapshots.

Restoring a Snapshot

To restore a VM to a specific snapshot, use the multipass restore command:

multipass restore <vm-name> --snapshot <snapshot-name>  

For example, to restore the “initial-state” snapshot of “test-vm”:

multipass restore test-vm --snapshot initial-state  

Deleting a Snapshot

To delete a specific snapshot, use the multipass delete command with the snapshot name:

multipass delete <vm-name> --snapshot <snapshot-name>  

For example, to delete the “initial-state” snapshot of “test-vm”:

multipass delete test-vm --snapshot initial-state  

Example Workflow

  1. Create a VM:
multipass launch -n test-vm  
  1. Create a snapshot of the VM:
multipass snapshot test-vm --name initial-state  
  1. Make changes to the VM:
multipass exec test-vm -- sudo apt-get update  
  1. Restore the VM to the initial snapshot:
multipass restore test-vm --snapshot initial-state  
  1. List snapshots:
multipass info test-vm  
  1. Delete the snapshot:
multipass delete test-vm --snapshot initial-state  

By using snapshots, you can easily manage and revert to different states of your Multipass VMs, making your development and testing processes more flexible and efficient.