Work with Volume Snapshots
Create a Volume Snapshot
- Navigate to Project > Volumes > Volumes.
- Find the volume you want to snapshot and click Create Snapshot in the Actions column.
Important
If the volume is attached to and in use by a running instance, creating a snapshot might not capture a fully consistent state of the data. To ensure data consistency when taking a volume snapshot, shut off the instance before initiating the snapshot.
- In the popup window that appears enter a Snapshot Name, optionally, add a Description, click Create Volume Snapshot and wait for the snapshot creation process to complete.
- After snapshot creation, verify that you can see the newly created volume snapshot under Projects > Volumes > Snapshots and that Status is
Available.
If the volume is attached to an instance you might want to shut off the instance first to prevent data corruption (no output if successful):
Verify the status of the instance is SHUTOFF:
Example output
+--------------------------------------+----------------------------------------+---------+--------------------------------------------------------------+--------------------------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+----------------------------------------+---------+--------------------------------------------------------------+--------------------------+----------+
| baceec24-7f97-4c2e-8270-bf28658936c1 | my-instance | SHUTOFF | MKNetwork=192.168.11.180, 2001:620:6:e021::50, 86.119.81.238 | N/A (booted from volume) | c004r008 |
+--------------------------------------+----------------------------------------+---------+--------------------------------------------------------------+--------------------------+----------+
Identify the volume attached to the instance by listing volumes for that instance:
Example output
Explanation:
f valueoption displays only the specified field's raw values, suitable for quick retrieval.c optionlets you choose a specific column to display.- Typically, the root volume is listed as the first one.
Create the volume snapshot:
Notice --force option in the above command. Unless you use this option, the command will fail because of the volume in-use status. Alternatively, you could detach the volume before taking the snapshot, but you won't be able to detach a root volume.
Example output
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| created_at | 2024-11-05T10:32:03.907291 |
| description | None |
| id | 563721b9-1baa-48be-95de-ce07a2ca425d |
| name | my-volume-snapshot-cli |
| properties | |
| size | 60 |
| status | creating |
| updated_at | None |
| volume_id | c76abb8a-2712-4dea-a31c-8c9702e0b20b |
+-------------+--------------------------------------+
Verify the volume snapshot creation:
Example output
+--------------------------------------------+--------------------------------------+
| Field | Value |
+--------------------------------------------+--------------------------------------+
| created_at | 2024-11-05T10:32:04.000000 |
| description | None |
| id | 563721b9-1baa-48be-95de-ce07a2ca425d |
| name | my-volume-snapshot-cli |
| os-extended-snapshot-attributes:progress | 100% |
| os-extended-snapshot-attributes:project_id | 91876c533032496fb2cdec6508a37022 |
| properties | |
| size | 60 |
| status | available |
| updated_at | 2024-11-05T10:32:11.000000 |
| volume_id | c76abb8a-2712-4dea-a31c-8c9702e0b20b |
+--------------------------------------------+--------------------------------------+
You can now restart your instance (no output, if successful):
Restore a Volume Snapshot
- Navigate to Project > Volumes > Snapshots.
- Find the snapshot you want to use to restore the volume and click on Create Volume in the Actions column.
- In the popup window that appears enter a Volume Name, select the volume snapshot in Use snapshot as a source field.
- Optionally, modify other volume settings.
- Click Create Volume and wait for the volume creation process to complete.
- After volume creation, verify that you can see the newly created volume in Project > Volumes > Volumes and that Status is
Available.
List volume snapshots to identify the one to restore:
Example output
+--------------------------------------+---------------------------------+-----------------------------------------+-----------+------+
| ID | Name | Description | Status | Size |
+--------------------------------------+---------------------------------+-----------------------------------------+-----------+------+
| 563721b9-1baa-48be-95de-ce07a2ca425d | my-volume-snapshot-cli | None | available | 60 |
+--------------------------------------+---------------------------------+-----------------------------------------+-----------+------+
Create a new volume from the snapshot.
Example output
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | true |
| consistencygroup_id | None |
| created_at | 2024-11-05T10:53:16.122635 |
| description | None |
| encrypted | False |
| id | ea3f5dca-ce5e-4d4b-8844-1c27f5f1ce20 |
| multiattach | False |
| name | my-restored-volume |
| properties | |
| replication_status | None |
| size | 60 |
| snapshot_id | 563721b9-1baa-48be-95de-ce07a2ca425d |
| source_volid | None |
| status | creating |
| type | standard |
| updated_at | None |
| user_id | 43bb91a04c174ef6af8857a205768f20 |
+---------------------+--------------------------------------+
Verify the new volume status is Available:
Delete a Volume Snapshot
- Navigate to Project > Volumes > Snapshots
- Find the snapshot you want to delete and click Delete Snapshot in the Actions column.
- Confirm the deletion in the popup window that appears.
- Verify the volume snapshot is not listed in Project > Volumes > Snapshots.
Important
Volume snapshots are directly tied to the original volume, and OpenStack requires the snapshot to be deleted before the volume can be deleted.
Delete the volume snapshot:
Verify the volume snapshot got deleted:
Important
Volume snapshots are directly tied to the original volume, and OpenStack requires the snapshot to be deleted before the volume can be deleted.