Backing up and Restoring Volumes and Snapshots

The command-line interface provides the tools for creating a volume backup. You can restore a volume from a backup as long as the associated database information (or backup metadata) is intact in the Block Storage database. You can also backup and restore a snapshot as you would a volume.

A snapshot and a backup are not interchangeable. A backup is a collection of data stored on non-volatile storage media for purposes of recovery in case the original copy of data is lost or becomes inaccessible. A snapshot is a copy of a virtual machine’s disk file at a given point in time. If at any time the volume is inaccessible, the snapshot is also inaccessible and is not a viable replacement for backing up data.

To create a backup of a volume:

$ openstack backup create [--incremental] [--force] <VOLUME>

You can use the following parameters:

  • VOLUME—is the name or ID of the volume.
  • incremental—indicates whether an incremental backup should be performed. Without the incremental flag, a full backup is created.
  • force—allows or disallows backup of a volume when the volume is in-use (attached to an instance) or available. Without the force flag, the volume is backed up only if its status is available. The force flag is False by default.

The backup of a volume in-use means your data is crash consistent.

The incremental and force flags are only available for Block Storage API v2. You must specify [--os-volume-api-version 2] in the command-line to use this parameter.

The force flag is new in Metacloud version 4.0.

The incremental backup is based on a parent backup which is an existing backup with the latest timestamp. The parent backup can be a full backup or an incremental backup depending on the timestamp.

The first backup of a volume must be a full backup. Attempting to do an incremental backup without any existing backups will fail. The is_incremental flag indicates whether a backup is incremental when showing details for the backup. The has_dependent_backupsflag indicates whether the backup has dependent backups. You cannot delete these backups when the flags are set to true.

To restore a volume from a backup:

$ openstack backup restore <BACKUP_ID>

When you restore from an incremental backup, the backup IDs from the parent provide a list of backups. A full restore is performed based on the full backup first, then restore is done based on the order of the incremental backups.

To view a backup list:

$ openstack volume backup list <BACKUP_NAME> <STATUS> <VOLUME_ID>

You can include --all-tenants for details of the tenants associated with the listed backups.

Volume backups are dependent on the Block Storage database. Your Block Storage database is backed up regularly to ensure data recovery.

To avoid backing up the entire Block Storage database, you can export and save the metadata of selected volume backups. This is useful if you need a small subset of volumes to survive a catastrophic database failure.

If you specify a UUID encryption key when setting up the volume specifications, the backup metadata stores the key to ensure it is valid when you back up and restore the volume.

To create a backup of a snapshot:

$ openstack volume backup create [--incremental] [--force] <SNAPSHOT>

Where <SNAPSHOT> is the name or ID of the snapshot.

You cannot snapshot a volume with NFS.