On Sat, Jul 11, 2020 at 13:04:51 -0400, Alex Regan wrote:
Hi,
I have a win10 guest on a fedora32 system and have some questions as I
explore using external snapshots as a form of backup in case of a Windows
failure (as in, it won't boot or is completely irrecoverable) as well as
revision control (to be able to rollback changes after a failed app install,
etc).
The first hit on Google for external snapshots involves a RHEL7 document
that talks about how it's not officially supported. The current RHEL8 docs
don't include any references to snapshots.
The fedora docs I've found are many years old - I'm just not sure if they're
still applicable. Where can I find the current docs for fedora32?
Libvirt keeps compatibility, so all old semantics still apply. There
might be newer approaches though.
- If I've already created a live internal snapshot, can I then
create an
external safely? Are all changes currently being written to this internal
snapshot now?
You can create an external snapshot on top of an image which already has
internal snapsots safely, but you will not be able to use libvirt APIs
to revert to the internal snapshot. (this is a thing which is not
implemented yet ...)
- Can external snapshots be used for backup? Perhaps there are
predefined
steps for doing this that I can follow?
I can't seem to find a link, but yes. By definition snapshot is a backup
of the VM state at the time when the snapshot was taken.
This is the procedure I'm currently using. I've made a backup
of the
original image - can I now just continue to backup the snapshots in the
eventuality of a crash, then use this original image backup and the
snapshots to restore it?
If you VM is running, you must only copy images which are no longer used
in write mode. This means, that after you take the snapshot the previous
snapshot image (or base image) can be copied safely.
I suppose I would also periodically merge the snapshots back into the
a
single snapshot to ease the process?
Yes, there is a theroetical limit of 200 chained images, so you must
keep it below.
# virsh snapshot-create-as --domain dave-win10a win10a-state01
--diskspec
vda,file=/var/lib/libvirt/images/vm_snapshots/disk-overlay.qcow2,snapshot=external
--memspec
file=/var/lib/libvirt/images/vm_snapshots/mem-overlay.qcow2,snapshot=external
--atomic
This creates a snapshot with memory, which is good. You can restore the
state of the VM to the state when the snapshot was taken including the
memory state.
If you don't take the snapshot with memory, the disk state is still
valid but looks like as if the VM was powered off without shutting down
the OS, thus filesystems may be inconsistent.
Note that if you merge away the disk images, the memory image becomes
invalid as you can't return to it's state.
Alternatively there is the incremental backup API (not stable yet
though) which can backup disk state without the need for complex image
merging.
Here are some articles on the nuances of capturing VM state and backups:
https://libvirt.org/kbase/domainstatecapture.html
https://libvirt.org/kbase/incrementalbackupinternals.html