Backup a VM with all its snapshots?
-
@olivierlambert Going back to my original question, I have a VM in XO with a few snapshots in its snapshot tab.
Is there a way to backup and restore the VM, such that everything is the same as before the backup (ie. a VM in XO with those particular snapshots in its snapshot tab.)
I'm struggling to express myself more clearly than this, is it clear what I'm trying to ask? I want the snapshots to be backed up and restored along with the VM, so everything appears the same as the original in the XO GUI.
-
Each snapshot is a VM per itself. If you want to be able to restore a backup from scratch with multiple date in the past, that's the "retention" number when you configure a backup job.
But no, you can't simple restore a VM from 0 with all its previous snapshots. The way to be able to restore at multiple points in the past is just called "retention", no problem to restore the same VM from different date if you like
-
@olivierlambert Thanks for the reply.
Hmm, we use snapshots as a specific record of certain named changes to our VMs, which we sometimes need to revert back to. Eg. (1) Base OS (2) Drivers and Apps installed (3) Prior to OS update (4) Post OS update, etc. Retention based on dates doesn't quite cover our use case.
There doesn't seem to be a way to backup a snapshot via the regular backup system, the only way is to export as XVA or copy it into its own VM entry?
Is there any way to populate the snapshots tab of a VM with exported / copied snapshots?
In VirtualBox, snapshots are a series of differencing images that only consume enough HD space to record changes. Is this not the case with XCP / XO? Is each snapshot a full standalone copy of the VM?
-
A backup is done via a snapshot
And yes, a snapshot is using copy on write. But what I'm explaining, is that your chain of snapshot is stored externally, on the backup storage, with the retention you like.
It's the first time I heard the use case of restoring a VM with all its previous snapshot It's not technically impossible, but it'sā¦ weird (at least new) to me.
-
@olivierlambert said in Backup a VM with all its snapshots?:
A backup is done via a snapshot
And yes, a snapshot is using copy on write. But what I'm explaining, is that your chain of snapshot is stored externally, on the backup storage, with the retention you like.
It's the first time I heard the use case of restoring a VM with all its previous snapshot It's not technically impossible, but it'sā¦ weird (at least new) to me.
It's not weird. We use this for application data - being able recover a version of a specific configuration, dataset or program version is quite useful. Like CVS/GIT, but for appllication data. Why not the same for VMs? I like this idea - to be able to preserve these versions with custom names etc.
Today I snapshot and export VMs to preseve specific states when I make bigger application upgrades/changes.
-
You can already do that with snaps (to rollback).
But recover a VM from scratch is an operation happening because you lost it. Shouldn't be your everyday operation Oo
-
@olivierlambert absolutely. But due to performance or space usage it might not be practical to save many snaps on main SR.
Though, making instant clones might be a better choice here?
-
It sounds like it may be beneficial to take a backup of the VM instead of a snapshot. It wouldn't preserve the chain and a store wouldn't be instant like a snapshot, but it might work for what you're doing?
Normally, from my understanding, snapshots really should be temporary as performance degrades the more you have.
-
@olivierlambert I think the other commenter put it nicely - we are using snapshots a little bit like version control for the VMs. One of the things we use VMs for is to build golden images for desktop PCs, so maybe that's an unusual use case...
Putting aside how it works under the hood, it's also a GUI thing - it's a nice way to view and organize past versions of the VM, by having a list inside the VM's snapshots tab. It would be messier and less clear if they were separate VMs in the main list or exported XVAs.
Not being able to backup and restore the snapshots list is a little bit like losing our version control if a disaster happened to XO. I guess we'll have to stop using this feature in this way, or make more effort to manually export the snapshots we really need to back up.
Also, can you please confirm / deny what the previous commenter (gsrfan01) said? Is there a performance reduction when having snapshots on a VM's list?
-
For a few snapshots it's fine - the issue comes when you have large numbers. Most of my first-hand experience with this specific issue comes from Hyper-V but the logic applies here.
This is from VMware but the concept is the same and has some good reading on snapshots in general.
Running a virtual machine on a snapshot for extended periods of time can cause instability and data loss.
https://kb.vmware.com/s/article/1015180The underlying issue stems from the nature of snapshots. With none you have a single VHD containing all of the data for the VM, once you take a snapshot a new delta VHD is created with all new data written going forward from the time of the snapshot. So, in order to have a complete VM you have the original VHD + the delta VHD.
This is fine in smaller numbers, but once you start having 10, 15, 20+ snapshots, every one of those represents an additional VHD in the chain. This results in performance degradation because you're reading from multiple potential files as only new data is written to the deltas.
This is actually from XO's blog: https://xen-orchestra.com/blog/xenserver-coalesce-detection-in-xen-orchestra/