How do I safely delete snapshots?

This is for discussing general topics about how to use VirtualBox.
Post Reply
hilarious
Posts: 5
Joined: 27. Sep 2015, 08:47

How do I safely delete snapshots?

Post by hilarious »

I've had 2 VDI files on my F: drive. Then Linux update killed one of my VMs and after I reinstalled it I made snapshots of both VMs so I can quickly restore them if it ever happens again. I saved them on my small SSD.

As I just found out those snapshots aren't really static and in fact have been my primary usage files. They've grown a lot and those VDIs on F: drive haven't been touched in months.

What should I do to keep my current states and move most recent VDIs to F:?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How do I safely delete snapshots?

Post by scottgus1 »

Best thing to do is make a full clone of the snapshotted vdi's (See CloneVDI). Use the cloned drive in your guest instead. Don't delete anything until you have your guest running perfectly on the cloned unsnapshotted vdi.

Snapshots make a guest more delicate and do not work as backups. They should only be used on guests you're experimenting with and with data you wouldn't mind losing. (The forums are replete with users destroying their important data because they did something wrong with a snapshot.)

Better way to restore a guest is to back it up safely. See this tutorial Moving a VM and re-interpret it as "Backing Up a VM".
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How do I safely delete snapshots?

Post by mpack »

scottgus1 wrote:Best thing to do is make a full clone of the snapshotted vdi's (See CloneVDI). Use the cloned drive in your guest instead. Don't delete anything until you have your guest running perfectly on the cloned unsnapshotted vdi.
Far be it from me to dissuade people from using CloneVDI, but in fact nowadays I'd recommend that you use the inbuilt VBox cloning function (right click, Clone) when cloning a VM. The difference is that the VirtualBox feature clones the VM, while CloneVDI only clones the selected media file. Also the VBox feature gives you fewer choices as to which snapshot state to clone, hence less room for error.

Make sure you choose "Current state only" when you are asked what to clone - this is the option that ensures that the snapshot structure is not copied as well.

Oh, and in future: don't confuse snapshots with backups. They aren't. They are more akin to restore points. By their very nature they freeze the current state and then have to record every deviation from that state into the future. IMHO it's much more clear cut to make a proper backup of your VM (to secondary meda) when necessary.

Final note: I detect the newbies common fixation with VDI files. The VDI is a disk, not the whole VM, and the other files while smaller can be just as important. Always move the entire VM folder as a unit, do not move the VDI. Howto: Move a VM.
hilarious
Posts: 5
Joined: 27. Sep 2015, 08:47

Re: How do I safely delete snapshots?

Post by hilarious »

Thanks guys. In the end turned out that clicking delete on the snapshot actually merges the VDIs so it's exactly what I needed. Instead of a 14 Gb on C and 10 on F I got a single 22Gb file on F: now.

Merry Christmas :D
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How do I safely delete snapshots?

Post by mpack »

hilarious wrote:Thanks guys. In the end turned out that clicking delete on the snapshot actually merges the VDIs so it's exactly what I needed.
Hmm. Except that you asked for the safest way to delete a snapshot, not the easiest. Now that it has worked you are fine, but had it failed (e.g. due to some kind of disk error) you could have lost the VM.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How do I safely delete snapshots?

Post by scottgus1 »

mpack wrote: The difference is that the VirtualBox feature clones the VM, while CloneVDI only clones the selected media file.
Mpack, Doesn't cloning the whole guest change the "motherboard" UUID presented to the guest? I have a vague recollection that re-activation issues or grub loader issues might happen?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How do I safely delete snapshots?

Post by mpack »

Yes, that's quite correct, but the OP was going to have to create a new VM anyway, if the intention was to make sure it was working prior to making any big changes to the original VM. The possible issues this could cause would just have to be dealt with - none are as catastrophic as a snapshot delete that goes wrong.
Post Reply