Snapshots: propagate changes from base to descendants

This is for discussing general topics about how to use VirtualBox.
Post Reply
Akon
Posts: 6
Joined: 18. Sep 2018, 07:51

Snapshots: propagate changes from base to descendants

Post by Akon »

Hello all. I'm wondering if there a way exists to change a base snapshot and propagate these changes to all descendant snapshots (when these descendants shapshots already created). There are two kinds of changes possible:
1. Virtual machine settings (e.g. RAM amount, shared folders, etc.).
2. Virtual machine's filesystem changes (e.g. add/remove/change files inside VM).

The second is not possible in wide case, I think.

But what about the first? It might be very useful. For example, changing RAM amount or adding/removing shared folder (to communicate with the host system) would allow to not create new snapshots just to only correct such settings. Also, it's a tool of flexibility. For example, one might add a shared folder to the parent snapshot and propagate that folder to all children snaphots automatically. Of course, there must be possibility to disallow such inheritance as an option for descendant snapshots.

At the moment I want to change shared folders in first (root) snapshot and propagate the changes to all other snapshots. Is it possible somehow? May be some binary patching with snapshot's binary files?

Thanks in advance.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Snapshots: propagate changes from base to descendants

Post by socratis »

Akon wrote:The second [sic: Virtual machine's filesystem changes] is not possible in wide case, I think.
Correct.
Akon wrote:At the moment I want to change shared folders in first (root) snapshot and propagate the changes to all other snapshots. Is it possible somehow? May be some binary patching with snapshot's binary files?
Actually, as you said, that's got to do with the settings, not the binary contents. It's the settings that you want to change.

There could be a way. But it's really, really, really dangerous, unless you're an expert in the format of the VBOX file, the VM "recipe". If you need to ask how, then it's not for you... ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Snapshots: propagate changes from base to descendants

Post by mpack »

Akon wrote: 1. Virtual machine settings (e.g. RAM amount, shared folders, etc.).
Some VM settings affect the snapshot, especially if the snapshot includes a saved state.

Frankly, if you want to be able to fiddle with each state independently then you should be using clones, or backups, not snapshots.
Akon
Posts: 6
Joined: 18. Sep 2018, 07:51

Re: Snapshots: propagate changes from base to descendants

Post by Akon »

Thanks all for answers.

I'm making the question more narrow. I'm considering shapshots for power-off state. As far as I understand VM settings - *.vbox file is saved inside binary snapshot file. I need to patch somehow the snapshot file to change some settings, e.g. easiest ones - like increasing RAM amount (patch one value). Actually, I need to change shared folder to be read-only (initially it's full access) and add another shared folder.

Are there any parsers exist for that? Maybe some command line tools from Oracle itself?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Snapshots: propagate changes from base to descendants

Post by socratis »

Akon wrote:As far as I understand VM settings - *.vbox file is saved inside binary snapshot file.
Where did you get that from? If you think that's the case, I would strongly urge you to follow mpack's advice, snapshots are more complicated.

If you want to learn more, see ch. 10.1. Where VirtualBox stores its files. And remember what I said:
socratis wrote:There could be a way. But it's really, really, really dangerous, unless you're an expert in the format of the VBOX file, the VM "recipe". If you need to ask how, then it's not for you... ;)
So, I'm sorry, but I will not personally give you the advice to screw your VMs and then coming back for help on fixing it. This is dangerous stuff, and in hindsight, I shouldn't even have mentioned that there is a potential way to do it. It's NOT for beginners, which you clearly are.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Snapshots: propagate changes from base to descendants

Post by mpack »

Akon wrote: As far as I understand VM settings - *.vbox file is saved inside binary snapshot file.
There is no "binary snapshot file". VM settings for all states of a snapshot chain are stored in the same .vbox file, which is an xml text file. Disk states are stored in a chain of binary difference images, typically in VDI format. If the snapshots are created at runtime then there is also a memory dump for each state, saved in a binary .sav file. The latter is the file that would be sensitive to RAM size changes.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Snapshots: propagate changes from base to descendants

Post by mpack »

On reflection, I wonder if you aren't thinking of the embedded text descriptors found in multi-part VMDK files, conflating that with the .vbox descriptors used to describe a VirtualBox snapshot chain. Of course there is no connection between those two features.
Akon
Posts: 6
Joined: 18. Sep 2018, 07:51

Re: Snapshots: propagate changes from base to descendants

Post by Akon »

Many thanks for clarifications!

Indeed, VM's settings are stored in *.vbox file (XML-file), but the last is regenerated when you switch snaphots. Thus, my assumption issued from that fact - I assumed *.vbox file is stored in snapshot file, i.e. VM's settings are stored here either. That assumption was appearing logical - if I delete last snapshops manually as files (e.g. from Windows Explorer), I don't break the system and don't leave metadata from deleted snapshots. I simply detete last diffs.

No I see that *.vbox file contains information about all snapshots, even if it corresponds to the first (most earliest) snapshot. And snapshot files look as VM filesystem diff only. That way is more direct to implement. But again, why not to use diff scheme for *.vbox files also?

So, my task becomes easy - change XML-file for desired properties. E.g. add a shared folder to all snapshots listed. Am I right?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Snapshots: propagate changes from base to descendants

Post by mpack »

It doesn't use a diff scheme for settings because the data is small, hence the disk space savings don't justify the risk and complexity.

We can't really encourage anyone to modify vbox files manually. You must do that at your own risk.
Akon
Posts: 6
Joined: 18. Sep 2018, 07:51

Re: Snapshots: propagate changes from base to descendants

Post by Akon »

I successfully did it. In a text editor I added new shared folders and changed properties of existed ones.
Post Reply