Working with Cinder snapshots

Within Cinder, volume snapshots provide a way to non-disruptively copy a volume. This allows for volume backups. It also enables more advanced backup features and provides the ability to boot an instance from a given snapshot or point in time.

In this section, we will show you how to create a snapshot, refresh a snapshot, and delete a given snapshot.

Getting ready

Ensure that you are logged in to the Ubuntu host where the Cinder command-line utilities are installed and source your OpenStack environment admin credentials.

How to do it...

  1. To create a snapshot, the volume must not be attached to an instance. To list your current volumes, you can use the cinder list command:
    $ cinder list
    

    Here's the output:

    How to do it...

    Tip

    If the volume you wish to take a snapshot of has an in-use status, you will need to detach it using the instructions in the Detaching volumes from an instance recipe in this chapter.

  2. As our volume is available, we will create a snapshot of the volume using the cinder snapshot-create command:
    cinder snapshot-create b3e0f6b2-19cb-436f-a190-4b5c66ba2daf
    

    Here's the output:

    How to do it...
  3. Once the snapshot is complete, you can reattach it to an instance and continue operations. If using snapshots as part of an ongoing test/validation process or part of a backup scheme, you may want to update the snapshot with fresh data. To do this, we use the cinder snapshot-reset-state command, which produces no output if successful.
  4. Finally, you will need to delete snapshots. To do this, use the cinder snapshot-delete command as follows:
    cinder snapshot-delete 63c3173b-4f30-4240-99f2-fd2e82cb757e
    

    Confirm whether the volume is deleted with the cinder snapshot-list command:

    cinder snapshot-list
    

    Here's the output:

    +----+-----------+--------+--------------+------+
    | ID | Volume ID | Status | Display Name | Size |
    +----+-----------+--------+--------------+------+
    +----+-----------+--------+--------------+------+
    

How it works...

Cinder volume snapshots provide a flexible way to clone volumes for backup, attaching to other instances and more. The cinder snapshot- commands we used here—specifically cinder snapshot-create, cinder snapshot-list, cinder snapshot-reset-state, and cinder-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 a particular snapshot depends on the underlying driver.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset