Page 1 of 1

When do virtual hard drives get modified?

Posted: 5. Aug 2009, 09:29
by masonlee
I've read the user docs a couple times, but am not totally clear on exactly when the "machine state" modifies the .vdi. Since changes to "normal" type virtual disks are lost if the virtual machine dies [EDIT: As per answer below, they are not lost--it's up to the guest to write.], I assume there is someplace other than the .vdi keeping the hard drive data. Could someone help me with the following questions?

1. When does VirtualBox write modifications into to a "normal" type .vdi image file (assuming no snapshots)? Only when you "Save the machine state" and when you "APCI power off" a machine?

2. What about for virtual hard disks created from an "immutable" vdi disk image with "autoreset=off"? Same answer, with the only difference being the virtual machine has a local diff of the disk that it's saving to instead of the original .vdi?

3. Is there a VBoxManage command to write the contents of an active virtual hard disk to its respective .vdi without shutting off the virtual machine? I've found only 'VBoxManage controlvm <name> savestate", but that seems to always shut down the machine.

Thanks!

Re: When do virtual hard drives get modified?

Posted: 5. Aug 2009, 20:19
by Sasquatch
1) Changes are written when the Guest OS writes to it's hard drive (the VDI). You can check this by opening a file manager on the Host and monitor the modified date while writing in the VM (like installing a big program). If the power would suddenly fail on the Host, then the Host OS is the one that messes things up, not VB.

2) See 1). Only difference is that the VM is still usable if the reset file is corrupt. You just remove it and a new one will be created, but you will loose all changes, which is obviously why you use immutable.

3) No there is no such command. The Host handles the actual writeback of the data. VB only gives the command to write data to disk to the Host OS.

Re: When do virtual hard drives get modified?

Posted: 6. Aug 2009, 01:35
by masonlee
That behavior makes total sense. Much appreciated!