Introduction
In Cloudmin, a snapshot is a copy of the contents of all disks attached to a virtual system, taken at a point in time. After creating a snapshot you can make changes to the contents of the system's disks (such as installing or re-configuring software), and if that goes wrong you can roll back to the state when the snapshot was taken.
Snapshots do not include the contents of the virtual system's RAM - only disks. This means that a rollback will require that the system be rebooted.
System owners can be granted permission to create snapshots, either individually or at the plan level. Any disk space they consume will be counted towards the owner's disk limit.
Snapshots use "copy on write" to store differences between the virtual system disks at the time the snapshot was made and the current time. This means that the snapshot can be much smaller than the system it was made from - typically only 10 or 20%. However, once the space allocated to the snapshot has been consumed it will become unusable.
Requirements
In order to create and manage snapshots, a virtual system must satisfy the following requirements :
- The primary disk and all additional disks to be included in the snapshot must be stored in LVM logical volumes. Because snapshotting makes use of LVM's snapshot feature, it cannot be performed on regular files.
- The host system's kernel must support LVM snapshot merging. We have confirmed that CentOS 6, RHEL 6 and Debian 7 include this support.
- Snapshotting is only supported on open-source Xen and KVM systems.
- Only Cloudmin versions 7.1 and later support the snapshot feature
Creating a Snapshot
Once you have a virtual system that meets the requirements above, you can create a snapshot as follows in the UI :
- Open the Resources category, and click on Disk Snapshots.
- In the form at the bottom of the page, enter a unique ID for the snapshot (which can consist of only letters and numbers).
- Enter the percentage of the system's disk space that will be consumed by the snapshot. This is a tradeoff between the amount of disk space consumed and the number of changes the snapshot can store.
- Click the Create button.
To create a snapshot using the command line API, use the create-snapshot
command. For example :
cloudmin create-snapshot --host yourvm.cloudmin.com --id snapid --percent 20
Reverting to a Snapshot
To revert a system to the state it was in when the snapshot was taken, the steps are :
- Open the Resources category, and click on Disk Snapshots.
- Click on the ID of the snapshot you want to revert to.
- Click the Revert button.
Reversion should be relatively fast, as only disk blocks changed since the snapshot was created need to be copied.
From the command line you can revert a snapshot with the merge-snapshot
command, like so :
cloudmin merge-snapshot --host yourvm.cloudmin.com --id snapid
Deleting Snapshots
If a snapshot is no longer needed, it can be removed by checking the box next to it on the Disk Snapshots page and clicking the Delete button.
From the shell, you can use the delete-snapshot
command. For example :
cloudmin delete-snapshot --host yourvm.cloudmin.com --id snapid
Limitations
There are some limitations to take into account when using snapshots :
- When a virtual system is moved to a new host, snapshots will not be transferred. Instead, they will be deleted from the original host.
- When snapshots exist for a virtual system its disks cannot be resized.
These are limitations of the underlying LVM snapshot system that Cloudmin uses.