Creating a Backup of a Multipass Instance - dialloi659/multipass GitHub Wiki

Creating a Backup of a Multipass Instance

Creating a backup of your Multipass instance is a straightforward process. Follow the steps below to quickly create a backup or refresh your memory on how to do it.

Scenario 1: Creating a Backup

  1. List all running instances to identify the one you want to back up:

    multipass list
  2. Stop the instance you want to back up using its name:

    multipass stop <instance_name>
  3. Create a tarball archive of the instance's root file system:

    multipass transfer <instance_name>:/ <backup_directory>/<backup_name>.tar.gz

    Replace <instance_name> with the name of your instance, and <backup_directory> with the directory path where you want to save the backup. Also, provide a suitable <backup_name> for the backup file.

  4. Start the instance again after the backup process:

    multipass start <instance_name>

Congratulations! You have successfully created a backup of your Multipass instance.

Scenario 2: Restoring from a Backup

To restore your Multipass instance from a backup, follow these steps:

  1. Stop the instance you want to restore using its name:

    multipass stop <instance_name>
  2. Remove the existing instance:

    multipass delete <instance_name>
  3. Recreate the instance using the same specifications (name, CPU, memory, disk size) and the appropriate cloud-init file if needed:

    multipass launch --name <instance_name> --cpus <cpu_count> --mem <memory_size> --disk <disk_size> --cloud-init <cloud_init_file>

    Replace <instance_name> with the desired instance name, <cpu_count> with the desired number of CPUs, <memory_size> with the desired amount of memory, <disk_size> with the desired disk size, and <cloud_init_file> with the path to the cloud-init file if required.

  4. Restore the backup files to the new instance:

    multipass transfer <backup_directory>/<backup_name>.tar.gz <instance_name>:/

    Replace <backup_directory> with the directory where the backup file is located, <backup_name> with the name of the backup file, and <instance_name> with the name of the newly created instance.

  5. Start the restored instance:

    multipass start <instance_name>

That's it! You have successfully restored your Multipass instance from a backup.

Remember to adjust the commands and variables based on your specific setup and requirements. Backing up and restoring instances is a great way to ensure the safety and preservation of your Multipass environments.

⚠️ **GitHub.com Fallback** ⚠️