`multipass clone` command

The multipass clone command creates a clone of an instance. A cloned instance is a standalone instance that is a replica of the original instance in terms of its configuration, installed software, and data at the time of cloning. Cloning an instance can be useful for backup or testing purposes, or to create identical VMs from a working template.

The clone command is available since Multipass version 1.15.0.

Currently, only instances that are in the Stopped state can be cloned.

You can run the clone command on a source instance without any additional options. For example, multipass clone natty-nilgai will produce the following output:

…
Cloned from natty-nilgai to natty-nilgai-clone1.

By default, the multipass clone command automatically generates a name for the cloned instance using the format <source_vm_name>-cloneN, where N represents the number of instances cloned from that specific source instance, starting at 1. In the example, the name of the source VM is “natty-nilgai” and the automatically generated name for its clone is “natty-nilgai-clone1”.

Alternatively, you can specify a custom name for the cloned instance using --name option, following the standard instance name format. For example:

multipass clone natty-nilgai --name custom-clone

The full multipass help clone output explains the available options:

Usage: multipass clone [options] <source_name>
Create an independent copy of an existing (stopped) instance.

Options:
  -h, --help                     Displays help on commandline options
  -v, --verbose                  Increase logging verbosity. Repeat the 'v' in
                                 the short option for more detail. Maximum
                                 verbosity is obtained with 4 (or more) v's,
                                 i.e. -vvvv.
  -n, --name <destination-name>  An optional custom name for the cloned
                                 instance. The name must follow the usual
                                 validity rules (see "help launch"). Default:
                                 "<source_name>-cloneN", where N is the Nth
                                 cloned instance.

Arguments:
  source_name                    The name of the source instance to be cloned

Errors or typos? Topics missing? Hard to read? Let us know or open an issue on GitHub.

Hi @georgeliaojia , thanks for your draft! I think it covers what needs to be said, the clone command is very straightforward. I’ve reviewed the content minimally, and suggested some improvements for the help text (pasted below as well).

In particular, I’d like to propose a different description for the --help option, if we agree I can submit PRs for all command files and change it. Instead of “Displays help on commandline options” I would say “Display this help message and exit”. What do you think?

Usage: multipass clone [options] <source_name>
Create an independent copy of an existing instance. The instance must be stopped before you proceed.

Options:
  -h, --help                     Displays help on commandline options
  -v, --verbose                  Increase logging verbosity. Repeat the 'v' in
                                 the short option for more detail. Maximum
                                 verbosity is obtained with 4 (or more) v's,
                                 i.e. -vvvv.
  -n, --name <destination-name>  Specify a custom name for the cloned instance. 
                                 The name must follow the same validity rules as instance names 
                                 (see "help launch"). Default: "<source_name>-cloneN", 
                                 where N is the Nth cloned instance.

Arguments:
  source_name                    The name of the source instance to be cloned

I’ve reviewed and it looks great, thank you! I made only a small update to use one of our animal names for the VM examples: natty-nilgai. Hope you find that makes sense.

1 Like

Thanks, Ricardo! OK, let’s consider it done it for when we’re ready to be published, then. Before the release, I’ll make sure to add cross-reference links where appropriate.

Hi @gzanchi
It also looks good to me.
The only thing I changed is the line break of the help text of --name option, where the actually command line output is slightly different with the same text.

1 Like