F37 kvm/qemu : How to create snapshots and manage them

Running f37 both on host and a vm created with kvm/qemu. I want to create a snapshot, run a few hazardous commands, then delete that snapshot so the vm is back and running per normal at the pre-hazardous state. How do I do that?
Thanks.

Welcome to the Fedora Project @netdogg

Best way to work with virtual environments is the virt-manager.

Try to start it from the terminal with virt-manager. If not available install it with sudo dnf install virt-manager

The virt-manager has a snapshots view, there you can create snapshots and delete them as soon you not need them anymore.

Do not use the docs just search in internet

virt-manager has been running on the host for months, perhaps a year, and I’ve used it a lot. I’ve looked through all the menus on it several times before and just now again, and nowhere does it say anything about snapshots… nothing at all. I also looked at the documentation you linked to and didn’t find anything there about snapshots either. Maybe you could provide a precise link.

When you go into a virtual machine the snapshot icon is on the far right. It sort of looks like two displays on top of each other.

That being said, you don’t want to delete the snapshot to put the machine in a prior state. You want to restore the snapshot to put the machine in a prior state.

4 Likes

@netdogg seems correct.
snapshots do not appear anywhere in virt-manager without the VM selected (and maybe running)

In years using qemu/kvm I had never seen nor been aware of the snapshot tool in virt-manager until @dalto posted just now.

@dalto, great, yeah, I see that now. It’s, not in the “Virtual Machine Manager” window, but rather in the actual vm window-- where the vm runs-- at the top. Thanks for that.

But I don’t understand your second paragraph. After I click on the double-monitor icon, the contents of the window no longer show the running, but what I’ll call a snapshot management window. At the bottom-left are four icons; their titles (seen when hovering the mouse pointer over them) are: Create new snapshot, Run selected snapshot, Refresh snapshot list, and Delete selected snapshot. Those titles make sense to me, and very seem to be what I’m looking for. The fact that I haven’t made a snapshot yet is shown by the absence of any snapshots listed. There’s no mention in this window of restoring a snapshot.

It is just a terminology difference.

The point I was trying to make is that a snapshot is a reference to a point in time. Deleting a snapshot won’t take your VM to a prior point in time. It will remove your ability to return to that point in time.

1 Like

Here we go:

1 Like

Unfortunately generic answers are often more confusing than no answer. Going down the rabbit hole of searching docs without at least a pointer of the portion to peruse may be a waste of time and effort.

When I post a link I try to make it at least relevant to the discussion and informative, and I always try to look at the content to ensure that.

Thank you for the image with the info. It was what I found after @dalto had posted his reply.

Your link to the redhat info goes directly to the point the customer was asking.

Might I suggest that we start a separate topic about the appropriate level of help to give to users if one is needed and allow this topic to focus on helping @netdogg with their technical issue?

Apparently one does not “restore” a snapshot under the VMM. One merely selects the desired snapshot and launches it so the running system is exactly as it was when the snapshot was created.

I have not had time to test how that might affect snapshots that were created at a later time. Potentially they still would remain valid snapshots if I understand the displays correctly.

If your virtual maching is using UEFI, the snapshot doesn’t work.
See https://unix.stackexchange.com/questions/663372/error-creating-snapshot-operation-not-supported-internal-snapshots-of-a-vm-wit

You can also do a search for the text internal snapshots of a VM with pflash based firmware are not supported.

1 Like

@dalto, Thanks. After playing around with a snapshot, I see what you mean now. I guess I read a few times about “running a snapshot” and got the wrong impression about it. Then too, “snapshot” isn’t a great term for it. A better metaphor would be a bookmark, because, as you rightly said, it’s a “reference point in time” and not something which is “run”.

Thanks again.

1 Like

I did sudo qemu-img convert -O qcow2 /dev/sdd1 /home/spaceboy/images/fedora39.qcow2

then i removed the storage option and added a new storage option pointed to the qcow2 instead, and snaphots now work