This question already has an answer here:

I'm trying to mount a vdi file in ubuntu 13.10. I tried to

sudo apt-get install virtualbox-fuse

but it complains about not finding the package.

Converting it to raw is not really an option for me, I don't have enough free space.

marked as duplicate by Eric Carvalho, Fabby, Kevin Bowen, George Udosen, guntbert Jun 16 at 16:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 5 down vote accepted

virtualbox-fuse was deleted from apt repository. You can download it from Launchpad, and install it. Once you download it, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, navigate to where the file was downloaded, and run the command(s) below:

sudo dpkg -i <package_name>.deb

Once installed, you can mount the vdi by typing

sudo vdfuse -f /home/user/file.vdi /home/user/mountpoint

Note: virtualbox-fuse depends on virtualbox 4.1.18, and will not work with 4.2. Thanks to Marius.

  • 2
    This is the correct answer however should be pointed out that there is no virtualbox-fuse for virtualbox 4.2. For those of you that use 4.2, you should downgrade if you wish to use this software – marius-nyxpoint Jul 30 '13 at 9:04

Running Ubuntu 14.04 with Virtualbox 4.3.10 I installed the package by forcing dpkg.

sudo dpkg -i --force-depends virtualbox-fuse_4.1.18-dfsg-1ubuntu1_amd64.deb

Everything worked just fine after that.

When you mount the vdi file it just gives you access to the partitions, but you need to then mount the partition somewhere. For example:

mkdir ~/vdisk
mkdir ~/part1
sudo vdfuse -f Machine.vdi ~/vdisk
sudo mount ~/vdisk/Partition1 ~/part1
  • It is worth mentioning that this method will make apt angry until the package is uninstalled. Given that I was just trying to copy data off of a virtual machine that was refusing to boot, I just uninstalled the package when I was done. – David Baucum Oct 7 '14 at 14:19
  • sudo dpkg -i --force-depends virtualbox-fuse_4.1.22-dfsg-0ubuntu2_amd64.deb – diyism Jun 19 '15 at 10:07

Based on @gavenkoa's answer, but for mounting an existing image instead of creating a new one::

$ sudo apt-get install qemu-utils
$ sudo modprobe nbd max_part=16
$ sudo qemu-nbd -c /dev/nbd0 ~/path/to/my.vdi
$ sudo partprobe /dev/nbd0
$ sudo mount /dev/nbd0p1 /mount-target

If you have more than one partition, you can access them by number — nbd0p1 is partition 1, nbd0p2 would be partition 2, and so on.

After you finished your investigation, you should unmount VDI image from the network device.

$ sudo qemu-nbd -d /dev/nbd0

...For those of you that use 4.2, you should downgrade if you wish to use this software ...

This is not correct! The 4.1-version of "vbfuse" is compatible to the 4.x line of the official virtualbox versions.

Just download the virtualbox-fuse package, but don't install it with:

sudo apt-get install -d virtualbox-fuse

Instead, simply copy the package to a (temporary) directory, extract is and copy the "vdfuse" binary over to your system:

mkdir /tmp/vboxfuse
cd /tmp/vboxfuse
mv /var/cache/apt/archives/virtualbox-fuse*.deb .
dpkg -x virtualbox-fuse*.deb .
cp -av usr/bin/vdfuse /usr/bin/.
cd /tmp
rm -rf vboxfuse

You will need root privileges to execute some of the above commands depending on the permissions of /usr and /var in your system.

This way you don't have to uninstall your virtualbox-4.x. Tested under Ubuntu 12.04, but also should work on other versions.

See: https://wiki.blue-it.org/VirtualBox#Mount_a_vmdk_file_in_linux

  • 1
    This doesn't work with .vdi files. – Ken Sharp Feb 4 '14 at 22:13

Prepare working environment::

$ mkdir ~/devel/lfs
$ VBoxManage createhd --filename ~/devel/lfs/lfs.vdi --size 2000 --format VDI

Get required packages::

$ sudo apt-get install qemu-utils
$ sudo modprobe nbd max_part=16

Without max_part=16 I get error on Debian for later commands::

$ sudo partprobe /dev/nbd0                                                                                                                
Error: Error informing the kernel about modifications to partition /dev/nbd0p1 -- Invalid argument.
This means Linux won't know about any changes you made to /dev/nbd0p1 until you reboot -- so you shouldn't mount it or use it in any
way before rebooting.                                                                               
Error: Failed to add partition 1 (Invalid argument)

Make partitions and format::

$ sudo qemu-nbd -c /dev/nbd0 ~/devel/lfs/lfs.vdi
$ { echo mklabel msdos; echo mkpart primary ext2 0s -1s; echo quit; } | sudo parted /dev/nbd0
$ sudo partprobe /dev/nbd0
$ sudo mkfs.ext3 /dev/nbd0p1

and mount image::

$ mkdir ~/devel/lfs/image
$ sudo mount /dev/nbd0p1 ~/devel/lfs/image

After you finished your investigation, you should unmount VDI image from the network device.

$ sudo qemu-nbd -d /dev/nbd0
  • That's great but he only wants to mount the image, not destroy all the data on it. – Ken Sharp May 7 '15 at 1:25
  • 2
    follow exactly the same instructions but skip the parted and mkfs lines to mount an existing image (and obviously also the createhd) – lalomartins Jul 27 '15 at 21:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.