Introduction to Snapshots
What is a Snapshot?
In OpenStack the term snapshot is used for two very different things:
- VM Snapshots: They capture the entire state of a virtual machine, including its operating system, application configurations, and data on attached volumes. Once you create a snapshot of a VM, it is stored as an image. This image is independent of the original VM, so you can delete the VM without affecting the snapshot. The snapshot (now an image) can be used to launch new instances, even if the original VM is deleted. However, creating a VM snapshot will also create a snapshot of the root volume and any additional attached volumes.
Important
This will affect your quotas. If any of these volume snapshots get deleted you won't be able to launch an instance from the VM snapshot.
- Volume Snapshots: They save the current state of the volume. They can be used to create new volumes. The new volume will then reflect the state of the volume at the time the snapshot was taken. If the original volume was bootable, then the new volumes will be bootable as well.
Important
Volume snapshots are directly tied to the original volume, and OpenStack requires the snapshot to be deleted before the volume can be deleted. Also, you won't be able to extend the original volume until the snapshot exists. If you try to extend the originial volume it will end up in Error Extending
status.
Why Use Snapshots?
Here are some common reasons to use snapshots:
- Data Backup and Recovery: Snapshots act as quick backups, allowing you to recreate a VM or a volume to a known good state after unexpected data loss or corruption.
- Testing and Development: Snapshots enable you to clone environments quickly, making it easy to test changes, updates, or application deployments without impacting production.
- Versioning: By creating snapshots at different stages, you can save versioned copies of a VM or volume and revert to previous versions as needed.
- Migration and Duplication: Snapshots can be used to create identical VMs or volumes, simplifying migration or scaling efforts.