[SOLVED] qcow2 snapshot file location?

LooneyTunes

Active Member
Jun 1, 2019
203
16
38
Hi,
I am using cqow2 on NSF storage an have taken quite a few, but after having changed the file structure (moved the folders of proxmox installation), my old snapshots are no longer visible. They do however conflict when trying to create new ones, sometimes telling me a snapshot of that name already exists.

I have been trying to figure out where and if there is a defined path somewhere, but has failed to find this. I found a post which I think should have lead me on, https://forum.proxmox.com/threads/snapshot-files-location.21651/
but, could not find any relevant info in the file mentioned.

Code:
root@pve:/etc/pve/nodes/pve/qemu-server# cat 100.conf
agent: 1
bootdisk: scsi0
cores: 2
ide2: none,media=cdrom
memory: 4096
name: br2019ua3
net0: virtio=EA:XX:XX:XX:39:XX,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
parent: ConfBackup
scsi0: ProxMox:100/vm-100-disk-0.qcow2,size=50G
scsihw: virtio-scsi-pci
smbios1: uuid=xxxx6d3a-xxxx-xxxx-xxxx-xxxx4a18xxxx
sockets: 2
vmgenid: xxxx3165-xxxx-xxxx-xxxx-xxxxadfaxxxx

1. What path is used for the snapshots?
2. How can I restore the old ones?

Thanks
 
Hi,

What path is used for the snapshots?

For qcow2? The qcow2 file itself. qcow2 stands for "QEMU Copy On Write 2", what COW means is maybe better described here: https://en.wikipedia.org/wiki/Copy-on-write#In_computer_storage

Anyway, the snapshots in the storage itself still exists, so it seems, but all references from the configuration have gone missing, did you messed with the config manually or did you not really copy all over?

As for snapshots we naturally need to save the config state too, as after taking a snapshot one can alter the VMs configuration in such a way that it becomes incompatible with the storage state saved in the snapshot.

A config with snapshots would look something like this:
Code:
cores: 2
memory: 4096
...


[snapshot1]
cores: 2
memory: 2048
...

[snapshot2]
cores: 4
memory: 2048
# this one even was saved live-running, with memory state.
runningmachine: pc-i440fx-2.12
vmstate: local:105/vm-105-state-asd.raw
...

So, you basically have three possibilities, depending on what you want to achieve..
If you want to restore from snapshot and "rescue" them, either:
* find the old original config, get the snapshot entries and add it to your "copied" config
* if you do not have that file anymore, yeah then you need to have a bit of luck..., basically add a new snapshot entry to the configuration manually based of your current configuration (that may bring issues if the config change much since the snapshot create, but is your best chance), see my example above and use "qemu-img snapshot -l file.qcow2" to determine the name. Then copy the whole current configuration to it, maybe you need to throw in a "snaptime" (UNIX timestamp, you can get one with `date -d '20190227 12:02' '+%s'`, for example)

If you do not want the snapshots anymore:
* delete 'em, i.e., first list all those snapshots:
Code:
qemu-img snapshot -l /var/lib/vz/images/105/vm-105-disk-1.qcow2
(adapt above path, if unsure you can pass the "volume id" from the config to pvesmp path, e.g.: pvesm path local:105/vm-105-disk-1.qcow2)

Re-check that you really do not want them, then delete them:
Code:
qemu-img snapshot -d <SNAPSHOTNAME> /var/lib/vz/images/105/vm-105-disk-1.qcow2

Note that this all works only for qcow, but most storages with efficient snapshots save the snapshot somewhere "near" the current data, to be more efficient and save space.
 
Last edited:
  • Like
Reactions: LooneyTunes
Thanks for a really informative answer!

I did not find a way change the install path, so I did move it manually. I had to recreate new VM's and replace the disks with the old, which worked, kind of. I bet it is not the preferred way, and I wouldn't do it again if not really critical.

Since the old configs are gone, and most of the snapshots just are "working state" before adding config, I think I can safely delete them and start over.

Thanks!
 
Btw, I seem to be missing the option to set tickets to "Solved". I know I am supposed to edit the first (my initial post), but I have no such option there. Could you help me or know who I can contact for this? Thanks
 
Just above your initial post here a "Thread Tools" drop-down button should be visible. As thread starter you should see "Edit Thread" in-there, here you should be able to change the tag to solved.

Note, this is a community forum only, posts here are not really tickets as one would know it from Enterprise Support, so one does not strictly needs to mark it as solved (often, with open questions or other user having followup questions or issues it's not always clear when it's really solved), but I naturally still appreciate that you want to tag this as such, and thus possible help others to better decide if they should either ignore it (if they wanted to answer) or click on it (if they search for the same issue).
 
Hi,



For qcow2? The qcow2 file itself. qcow2 stands for "QEMU Copy On Write 2", what COW means is maybe better described here: https://en.wikipedia.org/wiki/Copy-on-write#In_computer_storage

Anyway, the snapshots in the storage itself still exists, so it seems, but all references from the configuration have gone missing, did you messed with the config manually or did you not really copy all over?


Hi @t.lamprecht

I've done a mess deleting some file in the /etc and in the /etc/pve folder (don't ask me why, I was a dumb doing that!!!).

I have done a backup of my 3 VMs on Aug. 31st and I (should) have a snapshot for the VMs for the past 5 days.

The backup are on an external SSD, but how can I get the VMs snapshots?

Thanks
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!