Virtual Machine Backup, Snapshot & Restore

Virtual Machine Backup & Restore

Virtual machine backups are created from the Virtual Machines page. The virtual machine backup volumes will be stored in the Backup Target (an NFS or S3 server), and they can be used to either restore a new virtual machine or replace an existing virtual machine.

vm backup

A backup target must be set up. For more information, see Configure Backup Target. If the backup target has not been set, you’ll be prompted with a message to do so.

Configure Backup Target

A backup target is an endpoint used to access a backup store in SUSE Virtualization. A backup store is an NFS server or S3 compatible server that stores the backups of virtual machine volumes. The backup target can be set at Settings > backup-target.

Parameter Type Description

Type

string

Choose S3 or NFS

Endpoint

string

A hostname or an IP address. It can be left empty for AWS S3.

BucketName

string

Name of the bucket

BucketRegion

string

Region of the bucket

AccessKeyID

string

A user-id that uniquely identifies your account

SecretAccessKey

string

The password to your account

Certificate

string

Paste to use a self-signed SSL certificate of your S3 server

VirtualHostedStyle

bool

Use VirtualHostedStyle access only; e.g., Alibaba Cloud (Aliyun) OSS

Create a Virtual Machine Backup

  1. Once the backup target is set, go to the Virtual Machines page.

  2. Click Take Backup of the virtual machine actions to create a new virtual machine backup.

  3. Set a custom backup name and click Create to create a new virtual machine backup.

    create backup

Result: The backup is created. You will receive a notification message, and you can also go to the Backup & Snapshot > VM Backups page to view all virtual machine backups.

The State will be set to Ready once the backup is complete.

vm backup results

Users can either restore a new virtual machine or replace an existing virtual machine using this backup.

Restore a new virtual machine using a backup

  1. Go to the VM Backups page.

  2. Click the Restore Backup button at the top right.

  3. Specify the new virtual machine name and click Create.

  4. A new virtual machine will be restored using the backup volumes and metadata, and you can access it from the Virtual Machines page.

    restore vm

Replace an existing virtual machine using a backup

You can replace an existing virtual machine using the backup with the same virtual machine backup target.

You can choose to either delete or retain the previous volumes. By default, all previous volumes are deleted.

Requirements: The virtual machine must exist and is required to be in the powered-off status.

  1. Go to the VM Backups page.

  2. Click the Restore Backup button at the top right.

  3. Click Replace Existing.

  4. You can view the restore process from the Virtual Machines page.

    vm restore existing

Restore a new virtual machine on another SUSE Virtualization cluster

Users can now restore a new virtual machine on another cluster by leveraging the virtual machine metadata & content backup feature.

Prerequisites

  • v1.4.0 and later: The controller automatically syncs the virtual machine images with the new cluster, except when a virtual machine image with the same name or display name already exists on the new cluster.

  • Earlier than v1.4.0: You must upload and configure the virtual machine images on the new cluster. Ensure that the image names and configuration are identical so that the virtual machines can be restored.

Upload the same virtual machine images to a new cluster

  1. Check the existing image name (normally starts with image-) and create the same one on the new cluster.

    $ kubectl get vmimages -A
    NAMESPACE   NAME                               DISPLAY-NAME                              SIZE         AGE
    default     image-79hdq                        focal-server-cloudimg-amd64.img           566886400    5h36m
    default     image-l7924                        harvester-v1.0.0-rc2-amd64.iso            3964551168   137m
    default     image-lvqxn                        opensuse-leap-15.3.x86_64-nocloud.qcow2   568524800    5h35m
  2. Apply a virtual machine image YAML with the same name and content in the new cluster.

    $ cat <<EOF | kubectl apply -f -
    apiVersion: harvesterhci.io/v1beta1
    kind: VirtualMachineImage
    metadata:
      name: image-lvqxn
      namespace: default
    spec:
      displayName: opensuse-leap-15.3.x86_64-nocloud.qcow2
      pvcName: ""
      pvcNamespace: ""
      sourceType: download
      url: http://download.opensuse.org/repositories/Cloud:/Images:/Leap_15.3/images/openSUSE-Leap-15.3.x86_64-NoCloud.qcow2
     EOF

Restore a new virtual machine in a new cluster

  1. Setup the same backup target in a new cluster. And the backup controller will automatically sync the backup metadata to the new cluster.

  2. Go to the VM Backups page.

  3. Select the synced virtual machine backup metadata and choose to restore a new virtual machine with a specified virtual machine name.

  4. A new virtual machine will be restored using the backup volumes and metadata. You can access it from the Virtual Machines page.

Virtual Machine Snapshot & Restore

Virtual machine snapshots are created from the Virtual Machines page. The virtual machine snapshot volumes will be stored in the cluster, and they can be used to either restore a new virtual machine or replace an existing virtual machine.

vm snapshot

Create a Virtual Machine Snapshot

  1. Go to the Virtual Machines page.

  2. Click Take VM Snapshot of the VM actions to create a new virtual machine snapshot.

  3. Set a custom snapshot name and click Create to create a new virtual machine snapshot.

    create snapshot

Result: The snapshot is created. You can also go to the Backup & Snapshot > virtual machine Snapshots page to view all VM snapshots.

The State will be set to Ready once the snapshot is complete.

vm snapshot results

Users can either restore a new virtual machine or replace an existing virtual machine using this snapshot.

Restore a new virtual machine using a snapshot

  1. Go to the VM Snapshots page.

  2. Click the Restore Snapshot button at the top right.

  3. Specify the new virtual machine name and click Create.

  4. A new virtual machine will be restored using the snapshot volumes and metadata, and you can access it from the Virtual Machines page.

    restore vm snapshot

Replace an existing virtual machine using a snapshot

You can replace an existing virtual machine using the snapshot.

You can only choose to retain the previous volumes.

  1. Go to the VM Snapshots page.

  2. Click the Restore Snapshot button at the top right.

  3. Click Replace Existing.

  4. You can view the restore process from the Virtual Machines page.

    restore vm snapshot existing

Virtual Machine Snapshot Space Management

Volumes consume extra disk space in the cluster whenever you create a new virtual machine backup or snapshot. To manage this, you can configure space usage limits at the namespace and virtual machine levels. The configured values represent the maximum amount of disk space that can be used by all backups and snapshots. No limits are set by default.

Configure the Snapshot Space Usage Limit at the Namespace Level

  1. Go to the Namespaces screen.

  2. Locate the target namespace, and then select ⋮ → Edit Quota.

    edit quota namespace
  3. Specify the maximum amount of disk space that can be consumed by all snapshots in the namespace, and then and click Save.

    edit quota namespace save
  4. Verify that the configured value is displayed on the Namespaces screen.

    edit quota namespace read

Configure the Snapshot Space Usage Limit at the Virtual Machine Level

  1. Go to the Virtual Machines screen.

  2. Locate the target virtual machine, and then select ⋮ → Edit VM Quota.

    edit quota vm
  3. Specify the maximum total amount of disk space that can be consumed by all snapshots for the virtual machine, and then and click Save.

    edit quota vm save
  4. Verify that the configured value is displayed on the Quotas tab of the virtual machine details screen.

    edit quota vm read

Scheduled Virtual Machine Backups and Snapshots

SUSE Virtualization supports the creation of virtual machine backups and snapshots on a scheduled basis, with the option to retain a specific number of backups and snapshots. You can suspend, resume, and update the schedule at runtime.

Create the Virtual Machine Schedule

  1. Go to the Virtual Machine Schedules screen, and then click Create Schedule.

    create schedule
  2. Configure the following settings:

    configure schedule
    • Type: Select either Backup or Snapshot.

    • Namespace and Virtual Machine Name: Specify the namespace and name of the source virtual machine.

    • Cron Schedule: Specify the cron expression (a string consisting of fields separated by whitespace characters) that defines the schedule properties.

      The backup or snapshot creation interval must be at least one hour. Frequent backup or snapshot deletion results in heavy I/O load.

      If two schedules have the same granularity level, each iteration’s timing offset must be at least 10 minutes.

    • Retain: Specify the number of up-to-date backups or snapshots to be retained.

      When this value is exceeded, the SUSE Virtualization controller deletes the oldest backups or snapshots, and Longhorn starts the snapshot purge.

    • Max Failure: Specify the maximum number of consecutive failed backup or snapshot creation attempts to be allowed.

      When this value is exceeded, the SUSE Virtualization controller suspends the schedule.

  3. Click Create.

Check the Status of a Virtual Machine Schedule

  1. Go to the Virtual Machine Schedules screen.

  2. Locate the target schedule, and then click the name to open the details screen.

  3. On the Basics tab, verify that the settings are correct.

    check schedule basic
  4. On the Backups tab, check the status of the backups or snapshots that were created according to the schedule.

    check schedule backups

    Backups and snapshots that are marked Ready can be used to restore the source virtual machine. For more information, see Virtual Machine Backup & Restore and Virtual Machine Snapshot & Restore.

    check schedule restore

Edit a Virtual Machine Schedule

  1. Go to the Virtual Machine Schedules screen.

  2. Locate the target schedule, and then select ⋮ → Edit Config.

    edit schedule config
  3. Edit the Cron Schedule, Retain, or Max Failure values.

    edit schedule parameters
  4. Click Save to apply the changes.

Suspend or Resume a Virtual Machine Schedule

You can suspend active schedules and resume suspended schedules.

  1. Go to the Virtual Machine Schedules screen.

  2. Locate the target schedule, and then select ⋮ → Suspend or Resume.

    suspend resume schedule

    The schedule is automatically suspended when the number of consecutive failed backup or snapshot creation attempts exceeds the Max Failure value.

    SUSE Virtualization does not allow you to resume a suspended schedule for backup creation if the backup target is not reachable.

Virtual Machine Operations and SUSE Virtualization Upgrades

Before you upgrade SUSE Virtualization, ensure that no virtual machine backups or snapshots are in use, and that all virtual machine schedules are suspended. The SUSE Virtualization UI displays the following error messages when upgrade attempts are rejected:

  • Virtual machine backups or snapshots are being created, deleted, or used during the upgrade attempt

    upgrade vmbackup
  • Virtual machine schedules are active during the upgrade attempt

    upgrade svmbackup

To avoid such issues, SUSE plans to implement automatic suspension of all virtual machine schedules before the upgrade process is started. The suspended schedules will also be automatically resumed after the upgrade is completed. For more information, see Issue #6759.