I have a need to write to a VirtualBox guest's harddrive after a snapshot is taken (I cannot modify the original backing file (VDI, dd, whatever). I was hoping there was some way in VBox to modify the differenced snapshot disk through VBoxManage commands or their API (much like VMWare allows you to read and write sectors directly to a disk through their management commands / api, without interacting with the original file).
The only solution I have is scripting a series of tasks that inserts a bootable CD using VBoxManage storageattach, mounts any partitions it finds, executes commands, and automatically shuts down. I would rather interact with the machine with it turned off.
Ideally, I was hoping VirtualBox could expose something like a virtual block device on a Linux host so that I could mount it using whatever driver is needed and perform my necessary tasks.
I know there are tools to mount VDI's but these are not usable for several reasons. The most important being I can't modify the backing store (hence the snapshot), two being there aren't always VDI's (iSCSI targets could be the backing store instead of a local file)
VBox has some commands using VBoxManage guestcontrol (http://www.virtualbox.org/manual/ch08.html) however it requires the machine be on, guest additions installed, and credentials to an account on the guest. It also doesn't allow anything lower than file level access.