Mount a VirtualBox drive image (vdi)?

Is it possible to mount a VirtualBox drive image (.vdi) so the contents can be viewed in Nautilus etc.?

I have a windows 2000 .vdi which won't boot ("inaccessible boot device") after upgrading from VirtualBox 2.x to 3.1.6. I believe the IDE drive details have changed and that all I need to do is access the internal drive image and edit the Windows boot.ini to point to the new location.


Use qemu-nbd, the process is explained on serverfault and in this blog.

Basically, you'll have to install qemu if needed:

sudo apt-get install qemu

Then you'll need to load the network block device module:

sudo rmmod nbd
sudo modprobe nbd max_part=16

Attach the .vdi image to one of the nbd you just created:

sudo qemu-nbd -c /dev/nbd0 drive.vdi

Now you will get a /dev/nbd0 block device, along with several /dev/nbd0p* partition device nodes.

sudo mount /dev/nbd0p1 /mnt

Once you are done, unmount everything and disconnect the device:

sudo qemu-nbd -d /dev/nbd0

You can convert into standard image and then mount it.

VBoxManage clonehd --format RAW ubuntu.vdi ubuntu.img

Then

mount -t ext3 -o loop,rw ./ubuntu.img /mnt

You will need to KNOW the type of file system, ext3 in this case. After it is mounted, go in and edit away with the editor of your choice. Don't confuse files inside the /mnt location with the running host, or it will be bad.

To check details about your VDI file, run: VBoxManage showhdinfo ubuntu.vdi.

Source: [SOLVED] Open .vdi with archive manager? - ubuntuforums.org


It looks like vdfuse is the tool you are looking for. It is in the Ubuntu repositories. If you want to compile yourself (2010 source) you can do that too.

However for most of us it boils down to a simple:

sudo apt-get install virtualbox-fuse

It seems it now supports dynamic vdi as well.

And to mount the .vdi file in /mnt dir use the command:

sudo vdfuse -a -f /path-to-vdi-file /mnt

The entire disk will be mounted with partitions Partition1 , Partition2 naming format. Then those files can be loop mounted. For example,

sudo mount -o loop /mnt/Parition1 /mountpoint