support snapshots + rollback

We are running Cloudmin Pro and would like to know if there is a way to perform snapshots on the existing VMs.

I found the "clone" option but it seems that it actually duplicates the machine, which means it doubles the taken space (which is already very large as Cloudmin enforces pre-allocation).

Snapshots are a feature of VMWare Server 2.0, for example, which enable save+rollback to a certain know good state. Seems that the qcow2 image format supports a similar feature (savevm) but I'm not sure of how robust that is.

Snapshots are an important feature of virtualization systems.

Can you comment on this?

Status: 
Closed (fixed)

Comments

Snapshots could at least be "emulated" by using regular copies plus some kind of GUI controlled automation

  1. check for disk space, warn that operation takes time and pauses the VM
  2. ask for snapshot name and comment
  3. pause VM
  4. copy keeping the same settings (including IP) and storing with a different name that ends in -snapshot and save the user snapshot name + comment
  5. unpause VM

The rollback would just copying the "snapshot" over the original VM.

This could be implemented using LVM snapshots, which can be done instantaneously and only store the diffs between the LV at the time the snapshot was written and the current state.

What features do VMware snapshots provide - is their size or lifetime limited in some way, or does each consume the same amount of disk space as the VM?

AFAIK the free VMWare versions provide only a single snapshot per VM, so you get:

  • a safe return state for the VM
  • the ability to overwrite that state with the current state
  • the ability go to back to the saved return state

When the snapshot is taken is consumes the amount of space the VM was consuming (it is a copy of the vm hard disk), and the "live" VM starts consuming zero, because its hard disk, once a snapshot is taken, stores only diffs between the current state and the snapshot. As the live VM grows in difference from the snapshot, its size may grow arbitrarily.

http://blogs.vmware.com/vipowershell/2010/09/snapshot-size.html

We don't know about LVM since we haven't used it so far.

Free VMware versions snapshots allow you to store one safe returning state, revert to that state and overwrite that state with the current state.

Other VMWare versions may allow for several snapshots.

Here is the explanation about sizes: http://blogs.vmware.com/vipowershell/2010/09/snapshot-size.html

We've never used LVM so I don't know how its snapshots work. Note that snapshots are per VM, not per filesystem.

That sounds like a nice feature - I will look into implementing it.

It will require that VMs be created using LVM though, as KVM doesn't have built-in disk snapshotting .. so we would have to rely on LVM's snapshot feature. We recommend using LVM to store VM disk images anyway, as it avoids the overhead of using disk image files on the host filesystem.

Sorry for the duplicated comments. The server was giving error 500 yesterday and apparently failed to accept comments.

Regqrding LVM, I don't see how it saves overhead! It is an extra layer on top of the server fs. Regarding the implementation, that would be great. If you need further comments let me know.

Nice discussion on LVM snapshots:

http://serverfault.com/questions/41020/is-this-how-lvm-snapshots-work

Snapshots seem to be only useful for VMs that don't store files, so the changes don't make them overgrow.

VMs shouldn't store files anyway... Snapshots are great to store configuration states that would be time take consuming to redo manually, in case of an accident.

No problem regarding the duplicate comments -- one of your comments had been incorrectly marked as spam, and that was causing additional posts to throw a 500 error.

I marked your one post as ham, and deleted the duplicates. Sorry for the hassle!

If we were to implement this VM snapshot feature, I would most likely do it using an LVM snapshot that is the same size as the VM disk - that way it will be guaranteed to have enough space to store all possible changes. Although that could be made optional for admins who want cheaper (but possibly shorter-lived) snapshots.

FYI, snapshotting has been implemented for Xen and KVM systems in Cloudmin, and will be included in the upcoming 7.1 release. It requires that the VM's disk be on LVM though, and that the host system's kernel supports snapshot merging.

That's very nice!

Is CentOS6 is fully supported for snapshots, ie, does it have the right kernel and LVM versions?

Yes, CentOS 6 has the kernel support needed by default.

Excellent. We will try this soon, in the next Cloudmin install.

Automatically closed -- issue fixed for 2 weeks with no activity.