Can someone explain what a live snapshot is and how it differs from a regular backup?

Sempiterna

Active Member
Feb 2, 2014
17
3
43
It may be a rather stupid question, but the reason is ask this, is that i created a Live snapshot of a test Linux KVM of about 2.7GB in size. When the live snapshot creation was done, it was about 350 MB in size. Then, i deleted around 700MB of data, and did a "Rollback" to the state before the snapshot. To my surprise, all that data magically re-appeared.

The question really is, how is it a snapshot of 350MB can re-create 700MB of randomly deleted data (a few thousand files)? I assume (but not tested) that it will not re-create all 2.7GB if i were to wipe the VM's complete drive?
 
Re: Can someone explain what a live snapshot is and how it differs from a regular bac

afaik - i assume your snapshot are qcow2 - this kind of snapshotting works by leaving the original "base" qcow2 as it is, unchanged, and adding a "layer" of after-snapshot edits, to the whole system through a "snapshot" file. So you could have deleted 700 MB but the snapshot layer needed 350 MB of "changes" over the "base" qcow file.

Marco
 
Last edited:
Re: Can someone explain what a live snapshot is and how it differs from a regular bac

Pretty much what m.ardito said above. Snapshot "is" depended on base VM. If you were to delete the VM itself, it would lose ALL of the snapshots. Snapshot is really not a backup but a state. It is pretty much what Windows Restore point is or roll back. I believe a snapshot makes reference of data block not the actual data. Thats why it is extremely fast. Snapshot is very helpful when testing software, few accidental file deletion by user etc. But if a massive disaster occurs where VM itself gets corrupted/destroyed, snapshot will not be able to help. Snapshot also shares the concept of Linked Cloning, where every cloned VM also needs the original VM.
 
Re: Can someone explain what a live snapshot is and how it differs from a regular bac

Apart from the copy of the VM's memory you can compare a snapshot to an incremental backup. Each snapshot represents a point in time of the data and the added memory dump represents a point in time of the VM instance so if you take a snapshot and at the same time dump memory to the snapshot you are able to recreate an exact state in time from where you can continue as nothing has happen. For a more humorous visualization of what this is think of the movie 'Groundhog day' -> http://www.imdb.com/title/tt0107048/
 
Re: Can someone explain what a live snapshot is and how it differs from a regular bac

I just took it a step further, and did an "rm -Rf *" within the vm, freeing 2.7GB, and then installed windows XP. Then i rolled back the previously made snapshot. To my surprise, it returned my 2.7GB linux VM to its original state. All that from a (in this case) 317MB large file?

The snapshot file has not been updated since i made the snapshot, so i wonder where all the file differences are stored. Basically, the deletion of 2.7GB of data, the change in harddisk formatting, overwriting of sectors with data from Windows XP. Where does it get the information from to return the VM to its previous state?
 
Re: Can someone explain what a live snapshot is and how it differs from a regular bac

Then i rolled back the previously made snapshot. To my surprise, it returned my 2.7GB linux VM to its original state.

Look, when you snapshot, that image never changes anymore. Why are you surprised that reverting to that image the VM goes back identical. It is identical!
Nothing of this depends on your smaller "diff" image file that the VM is using after the snapshot : that file will increase/decrease as you use it, and just for what is needed.
Anyway it's also nothing specific to proxmox pve, see http://wiki.qemu.org/Features/Snapshots

Marco
 
Re: Can someone explain what a live snapshot is and how it differs from a regular bac

That was what i was thinking at first, that the "vm-<vmid>-state-<name>.raw" file would increase. However, that was not the case, because the new data (WinXP) was larger than that. The timestamp, as well as the size of that file remained the same. The only file whose timestamp did change throughout my changes was the original qcow2 file. If the "vm-<vmid>-state-<name>.raw" file does not change in any way, then where are the differences (or old state) stored?