Cinder volume snapshots provide a way to nondisruptively copy a volume; allowing for in-situ volume backups to be taken. It also enables more advanced backup features and provides the ability to boot an instance from a given snapshot or from a point in time.
In this section, we will show you how to create a snapshot, mount a volume based off a snapshot, refresh a snapshot, and delete a given snapshot.
To work with Cinder volume snapshots, you will need the following:
openstack
command-line clientopenrc
file with appropriate credentials for the environmentTo create a snapshot, the volume must be first detached from an instance:
available
, we will proceed to create a snapshot of the volume using the openstack volume snapshot create
command:openstack volume snapshot create --volume cookbook.volume cookbook.snapshot
This will produce an output like the following, showing a state of creating
:
cinder snapshot-reset-state
, which produces no output if successful:openstack volume snapshot list -c ID -c Name -c Status -f table cinder snapshot-reset-state cookbook.snapshot
openstack volume create --snapshot cookbook.snapshot newcookbook.volume
This will produce the following output. Note snapshot_id
that was used and the fact that we didn't specify a size:
openstack volume list –c Name –c ID –c Status –f table
This produces a list of our volumes and their state:
openstack volume snapshot delete
command as follows:openstack volume snapshot delete cookbook.snapshot
Confirm with openstack volume snapshot list
the list the remaining snapshots available.
Cinder volume snapshots provide a flexible way to clone volumes for snapshot type backups, attaching to other instances, and more. The cinder snapshot
commands we used here, specifically openstack volume snapshot create
, openstack volume snapshot list
, cinder snapshot-reset-state
, and openstack volume snapshot delete
, instruct cinder
to work with the storage driver to perform snapshot specific actions—create, list, update, and delete, respectively. The specific implementation of snapshot depends on the underlying driver.
Also note that you cannot use a snapshot directly with an instance. You must first create a new volume based on the snapshot of your choice. This has the following syntax:
openstack volume create --snapshot snapshot_name_or_id new_volume_name
18.219.220.22