Mounting/opening virtualbox disk image (vdi) on linux host
Solution 1:
For both fixed and dynamic-sized images:
On Linux you can use qemu-nbd
. On Debian it's in the qemu-tools package. It's likely in a similar package for other distros. It will let you mount any disk image recognised by qemu, which includes VDI.
Install it, modprobe nbd
to make sure it's loaded, then do a qemu-nbd -c /dev/nbd0 <vdi-file>
to make it available. It will show up as /dev/nbd0p? for each of the partitions in the image unless told to do otherwise. See the man page for further details.
When finished, a qemu-nbd -d /dev/nbd0
will detach it.
Be sure you don't have it attached in multiple places at once! This WILL cause problems!
Solution 2:
Tool for fixed size Disk Drives:
It can be done with static vdi images (Fixed Size, not dynamically expanding). It is a matter of finding the offset in the image where the partition starts.
Here is page that has a shell script that automates the process for you.
If Dynamic:
Method 1
If you are using a dynamically size image, convert it to a fixed size image (make sure you have the HD space) and then use the above tool (reference):
vditool COPYDD myDynamicDisk.vdi static_dump.vdi
Method 2
Reading up it seems vditool is no longer included. A simple way to create the partition image would be to use gparted iso as a boot disc inside of the Virtualbox VM to create the image of the partition to a location on your network, and then mount that image.
Fuse Module:
There is also a fuse file system for this called vdimount that does this, but I am not sure how well it works.