Temporary/discardable snapshots stored in a different path

This is for discussing general topics about how to use VirtualBox.
Post Reply
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Temporary/discardable snapshots stored in a different path

Post by birdie »

Whenever you create a snapshot for a VM you have to deal with two very annoying and unpleasant issues:

1) VirtualBox insists on storing snapshots in the /Path/to/VM/Snapshots directory which is not good when you want to always revert to the last snapshot.
2) VirtualBox, after reverting the changes and returning to the initially created snapshot, will always create a new UUID for it and basically rewrite a snapshot file for no reasons.

So, here's my situation. I have a number of guests with snapshots I always revert to after shutting down the guests. That's the idea, I don't need any updates on top of my last snapshots after shutting down the guest.

1) I want incremental changes to be stored in a separate directory, e.g. /tmp (I'm on Linux, /tmp is tmpfs, i.e. in RAM, i.e. it's blazingly fast)
2) I want to revert a guest to the initially created snapshot without changing either the configuration file (*.vbox) or the snapshot file.

How I've achieved it (it's really really tiresome):

1) I've created a Snapshots.bak folder for my VM where I store the first initial snapshot
2) My VM's Snapshot directory is pointing to /tmp/Snapshots
3) Whenever I need to power on my VM I copy the snapshot file from Snapshots.bak to Snapshots, I work with my VM, click Right Ctrl + Q -> Restore current snapshot
4) I delete the old Snapshots.bak/snapshot.vdi file and copy /tmp/Snapshots/last.vdi to it.

How can I avoid all of that? I just want to work with my VM while all the changes to its HDD are stored in `/tmp` and whenever I power it off, it's all discarded to the state of the last snapshot.
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Temporary/discardable snapshots stored in a different path

Post by Martin »

Have a look at "Special Image Write Modes" - "Immutable Images" in the manual:
https://www.virtualbox.org/manual/ch05. ... magewrites
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Temporary/discardable snapshots stored in a different path

Post by fth0 »

There could be an issue even with immutable images: They are not reset when powering off, but when powering on the next time. I'm not sure what happens when the differential image has disappeared before powering on ... let us know what you discover.
Post Reply