docs/doc/source/system_configuration/openstack/export-and-import-cinder-backups-to-ceph-pool.rst
Elisamara Aoki Goncalves 93ecdbb342 Update links to Openstack documentation
Remove ussuri version and add ANTELOPE version of Openstack docs links.
Remove CentOS path
Recheck zuul

Closes-bug: 2037761

Change-Id: Ia00ebbd8bac6ea8f004e295b30d63c2e07016382
Signed-off-by: Elisamara Aoki Goncalves <elisamaraaoki.goncalves@windriver.com>
2024-01-19 14:27:59 +00:00

3.5 KiB

Export and Import Cinder Backups to Ceph Pool

This document describes how to export and import Cinder backups stored in Ceph pool, along with their respective metadata.

  1. -openstack application is applied, up and running.
  2. The user has OpenStack admin credentials.

Create and Export a Volume Backup

Cinder doesn't guarantee the data consistency during a backup operation, so if the volume to be backed up is attached to a running VM and the application in the VM is not crash consistent, the recommended approach is to stop the VM for the backup procedure. Check the OpenStack documentation Back up and restore volumes and snapshots for more details.

  1. Create a volume backup:

    If the volume to be backed up is attached to a running VM, stop the VM first:

    $ openstack server stop <vm>

    Then, create the backup:

    $ openstack volume backup create --force [--name <backup_name>] <volume_id>

    where:

    --name is optional.

    --force allows you to back up an "in-use" volume.

    partner

  2. Export the backup image from Ceph pool:

    $ rbd list -p cinder.backups
    $ rbd export -p cinder.backups <backup_image> <path_to_backup_image_file>

    where <backup_image> uses the format volume-<volume_id>.backup.<backup_id>.

  3. Export the backup metadata from Cinder database:

    $ cinder backup-export <backup_id> > <path_to_backup_metadata_file>

Import and Restore a Volume Backup

  1. Import the backup metadata to Cinder database:

    $ backup_service=`grep "backup_service" <path_to_backup_metadata_file> | awk '{ print $4 }'`
    $ backup_url=`grep "backup_url" <path_to_backup_metadata_file> | awk '{ print $4 }'`
    $ cinder backup-import $backup_service $backup_url
  2. Import the backup image to Ceph pool.

    Check the ID of volume from which the backup was created:

    $ openstack volume backup show <backup_id>

    Import the backup image to Ceph pool:

    $ rbd import <path_to_backup_image_file> cinder.backups/volume-<volume_id>.backup.base
  3. Restore the backup to a new volume.

    If the volume in which the backup will be restored is attached to a VM, stop the VM and set the volume status to available:

    $ openstack server stop <vm>
    $ openstack volume set --state "available" <new_volume_id>

    Then, restore the backup:

    $ openstack volume backup restore <backup_id> <new_volume_id>

    If the volume was attached to a VM before the restore operation, set the volume status to in-use before starting the VM:

    $ openstack volume set --state "in-use" <new_volume_id>
    $ openstack server start <vm>