When do virtual hard drives get modified?

This is for discussing general topics about how to use VirtualBox.
Post Reply
masonlee
Posts: 5
Joined: 14. Jul 2009, 00:49
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: OpenSolaris 2009.6

When do virtual hard drives get modified?

Post 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!
Last edited by masonlee on 6. Aug 2009, 01:41, edited 1 time in total.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: When do virtual hard drives get modified?

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
masonlee
Posts: 5
Joined: 14. Jul 2009, 00:49
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: OpenSolaris 2009.6

Re: When do virtual hard drives get modified?

Post by masonlee »

That behavior makes total sense. Much appreciated!
Post Reply