Skip to content

Work with VM Snapshots

Create a VM Snapshot

  • Navigate to Project > Compute > Instances and click Create Snapshot in the row representing the VM you want to take the snapshot of.
  • A pop-up form will appear for creating the snapshot.
  • Fill in the Snapshot Name field.
  • Click Create Snapshot.
  • Navigate to the Project > Compute > Images. Here you will see the list of images and snapshots. Locate the snapshot you just created to ensure it is listed and the Status is Active.
  • Navigate to Project > Volumes > Snapshots to verify the volume snapshot(s) of the root volume and additional data volumes (if those were attached to the VM when taking a VM snapshot) were created.

Important

Creating a VM snapshot will also create a root volume snapshot and any additional data volume snapshots attached to the instance. This will affect your quotas. If any of those volume snapshots get deleted you won't be able to launch an instance from the VM snapshot.

List all instances to get the ID of the VM you want to snapshot:

openstack server list
Example output
+--------------------------------------+------------------+--------+--------------------------------------------------------------+--------------------------+----------+
| ID                                   | Name             | Status | Networks                                                     | Image                    | Flavor   |
+--------------------------------------+------------------+--------+--------------------------------------------------------------+--------------------------+----------+
| baceec24-7f97-4c2e-8270-bf28658936c1 | my-instance      | ACTIVE | MKNetwork=192.168.11.180, 2001:620:6:e021::50, 86.119.81.238 | N/A (booted from volume) | c004r008 |
| 525f7b2c-6d71-4123-988f-e637e383fbd6 | my-CLI-instance2 | ACTIVE | MKNetwork=192.168.11.150, 2001:620:6:e021::1b                | N/A (booted from volume) | c001r001 |
| f946a80d-1e24-462e-a297-25293bc12f86 | my-CLI-instance  | ACTIVE | MKNetwork=192.168.11.163, 2001:620:6:e021::31a               | N/A (booted from volume) | c001r001 |
+--------------------------------------+------------------+--------+--------------------------------------------------------------+--------------------------+----------+

Create a Snapshot of the VM:

openstack server image create --name <snapshot_name> <vm_id>
Example output
+------------------+--------------------------------------+
| Field            | Value                                |
+------------------+--------------------------------------+
| id               | 386cc48b-17e8-4a1a-94c4-69996288d250 |
| name             | my-instance-snapshot                 |
| status           | active                               |
| updated_at       | 2024-11-02T17:37:23Z                 |
+------------------+--------------------------------------+

You can verify the status of the snapshot by listing images and filtering by the snapshot name:

openstack image list --name <snapshot_name>
Example output
+--------------------------------------+----------------------+--------+
| ID                                   | Name                 | Status |
+--------------------------------------+----------------------+--------+
| 386cc48b-17e8-4a1a-94c4-69996288d250 | my-instance-snapshot | active |
+--------------------------------------+----------------------+--------+

You can verify the status of the volume snapshot(s) of the root volume and additional data volumes (if those were attached to the VM when taking a VM snapshot) status by listing volume snapshots:

openstack volume snapshot list
Example output
+--------------------------------------+-----------------------------------+-------------+-----------+------+
| ID                                   | Name                              | Description | Status    | Size |
+--------------------------------------+-----------------------------------+-------------+-----------+------+
| ac23b667-351b-4740-9100-538389161303 | snapshot for my-instance-snapshot |             | available |  120 |
| 4745b2c3-5909-4e17-a4bb-989452ed67eb | snapshot for my-instance-snapshot |             | available |   60 |
+--------------------------------------+-----------------------------------+-------------+-----------+------+

Important

Creating a VM snapshot will also create a root volume snapshot and any additional data volume snapshots attached to the instance. This will affect your quotas. If any of those volume snapshots get deleted you won't be able to launch an instance from the VM snapshot.

Restore a VM from a Snapshot

  • To restore a VM from a snapshot, navigate to Project > Compute > Images.
  • Select the snapshot and click Launch.
  • Follow the steps to create a new instance from this snapshot. You will need to choose the flavor or allocate security groups. However, by default, Horizon allocates the SSH key used in the original VM with the new instance created from its snapshot.
  • You can verify the instance was launched successfully in Project > Compute > Instances as well as the root and additional data volume snapshots (if applicable) in Project > Volumes > Volumes.

List images to confirm your snapshot exists:

openstack image list
Example output
+--------------------------------------+------------------------------+--------+
| ID                                   | Name                         | Status |
+--------------------------------------+------------------------------+--------+
| 96f7d911-ab56-47b9-9eba-576d17afb7a2 | Debian 12 (Switch Cloud)     | active |
| 00664a55-4f57-4ad3-8d00-1c653cf946f9 | Rocky Linux 9 (Switch Cloud) | active |
| e6b159e3-2ab5-43ec-b08c-9748bd2e0fbc | Ubuntu 22.04 (Switch Cloud)  | active |
| 3634adea-8f07-4807-952e-c5064248f944 | Ubuntu 24.04 (Switch Cloud)  | active |
| 386cc48b-17e8-4a1a-94c4-69996288d250 | my-instance-snapshot         | active |
+--------------------------------------+------------------------------+--------+

Create a New Instance from the snapshot:

openstack server create --flavor <flavor_id> --image <image_id> --network <network_id> --security-group <security_group_1> --security-group <security_group_2> --key-name <key_name> <instance_name>

Important

  • If no security group is specified in the openstack server create command, OpenStack assigns the default security group automatically.
  • If you specify a security group (e.g., only an SSH group), OpenStack will only apply the groups explicitly defined in the command. The default security group will not be assigned unless it is explicitly included.
Example output
+---------------------------+----------------------------------------------+
| Field                     | Value                                        |
+---------------------------+----------------------------------------------+
| OS-EXT-STS:vm_state       | building                                     |
| OS-EXT-STS:task_state     | scheduling                                   |
| adminPass                 | SriNSGr6a22M                                 |
| created                   | 2024-11-04T10:33:16Z                         |
| flavor                    | id='c001r001', name='c001r001'               |
| id                        | 64636568-4f90-4952-8840-2b49d92329ee         |
| image                     | my-instance-snapshot (386cc48b-17e8...)      |
| key_name                  | mykeycli                                     |
| name                      | my-new-instance-from-snapshot                |
| security_groups           | name='db243040-b1f0-46ec-8df6-2b92364807d2'  |
| status                    | BUILD                                        |
| updated                   | 2024-11-04T10:33:16Z                         |
+---------------------------+----------------------------------------------+

Verify the VM instance status:

openstack server list
Example output

``` +--------------------------------------+----------------------------------------+--------+--------------------------------------------------------------+--------------------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+----------------------------------------+--------+--------------------------------------------------------------+--------------------------+----------+ | 64636568-4f90-4952-8840-2b49d92329ee | my-new-instance-from-snapshot | ACTIVE | MKNetwork=192.168.11.111, 2001:620:6:e021::1ff | my-instance-snapshot | c001r001 | | 59ef0370-7eec-4824-817a-76d20798f7cf | my--new-instance-from-snapshot-HORIZON | ACTIVE | MKNetwork=192.168.11.134, 2001:620:6:e021::344 | N/A (booted from volume) | c001r001 | | baceec24-7f97-4c2e-8270-bf28658936c1 | my-instance | ACTIVE | MKNetwork=192.168.11.180, 2001:620:6:e021::50, 86.119.81.238 | N/A (booted from volume) | c004r008 | | 525f7b2c-6d71-4123-988f-e637e383fbd6 | my-CLI-instance2 | ACTIVE | MKNetwork=192.168.11.150, 2001:620:6:e021::1b | N/A (booted from volume) | c001r001 | | f946a80d-1e24-462e-a297-25293bc12f86 | my-CLI-instance | ACTIVE | MKNetwork=192.168.11.163, 2001:620:6:e021::31a | N/A (booted from volume) | c001r001 | +--------------------------------------+----------------------------------------+--------+--------------------------------------------------------------+--------------------------+----------+

In the example output above notice Name column - the second instance on the list was created from the same snapshot, but through the Horizon Dashboard.

Verify the volumes status:

openstack volume list
Example output
--------------------------------------+-------------------------------+--------+------+-----------------------------------------------------------------+
| ID                                   | Name                          | Status | Size | Attached to                                                     |
+--------------------------------------+-------------------------------+--------+------+-----------------------------------------------------------------+
| 44f5707a-2702-42c1-b829-1724cb4ca204 |                               | in-use |  120 | Attached to my-new-instance-from-snapshot on /dev/sdb           |
| 6a05fe73-1488-49bb-8dec-574993a5ea85 |                               | in-use |   60 | Attached to my-new-instance-from-snapshot on /dev/sda           |
| 8364ca30-a5a6-4b10-abb4-a48b9b3b2a16 |                               | in-use |  120 | Attached to my--new-instance-from-snapshot-HORIZON on /dev/sdb  | 
| 3cdd81d1-0993-4752-8cd5-1af277172c75 |                               | in-use |   60 | Attached to my--new-instance-from-snapshot-HORIZON on /dev/sda  |
+--------------------------------------+-------------------------------+--------+------+-----------------------------------------------------------------+

When restoring an instance from a VM snapshot using:

  • Horizon Dashboard: Image Name field will display the original image name used to provision the VM.
  • CLI: The Image Name field will display the snapshot image name.

Important

Unlike Horizon Dashboard, the CLI does not automatically allocate the SSH key from the original VM when creating an instance from a snapshot. To connect to your instance, you must explicitly specify the SSH key using the --key-name <key_name> option in the openstack server create command.

instance-image-name

Delete a VM Snapshot

  • Navigate to Project > Compute > Images and select the snapshot you want to delete and click Delete Image.
  • Confirm the deletion in the popup dialog box.
  • Ensure that the snapshot is no longer listed in the Images section to verify that it has been successfully deleted.

Important

Keep in mind that deleting the VM snapshot does not delete the associated volume snapshots created along with the VM snapshot. Those will be listed and can be deleted in the Project > Volumes > Volumes panel.

List images to confirm the snapshot ID you want to delete:

openstack image list

Delete the snapshot (no output, if successful):

openstack image delete <snapshot_id>

Verify by listing images again. Or you can verify by listing with the snapshot name specified (No output if the image is deleted):

openstack image list --name <snapshot_name>

Important

Keep in mind that the volume snapshots created along with the VM snapshot creation WERE NOT deleted by following the above steps.