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.

2 Answers 2


An improved workaround:

You can create a bootable CD image (or an additional disk which becomes the boot disk and which you remove afterwards) which does not mount the disk but starts sshd. A script on the host can connect via ssh and export the device file of the disk via sshfs. But I have to admit that I have never tried to access a device file via sshfs. If that is not possible then my next try was to map the device file to a regular file via e.g. FUSE.


Per a conversation with the VirtualBox developers, this is not possible. Their only suggestion was using a bootable cd that performs the necessary actions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .