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.


10 Answers 10


You can convert into standard image and then mount it.

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


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

  • 4
    Specilly useful in a situation like this. OP will be able to work on the copy keeping the original as backup. – Javier Rivera Dec 30 '10 at 15:22
  • 10
    Careful doing this with dynamically sized .vdi files. Converting to .img will force the image file to be as big as the logical size of the disk, which is why this approach works, but it might be much larger than .vdi file was. Take a look at the output of VBoxManage showhdinfo [your vdi file] if you're not sure. – Jack O'Connor Aug 25 '13 at 22:21
  • 2
    -1, stwissel and Maxime R.'s answers provide solutions--this is a fair workaround, but not the best answer to the question – STW Feb 17 '15 at 18:39
  • 4
    If the image has a partition table (like most drives), then you will need to combine this answer with this one to mount the individual partitions. – bain Mar 22 '15 at 19:49
  • 2
    Doesn't work. Keep getting mounting errors wrong fs type. I tried ext3 and ext2 and ext4 . Virtual box says the hd fs type is ext4 . – Joshua Robison Oct 14 '17 at 6:32

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
  • I'd like to note that max_part=16 seems to be a critical part. Without it you won't see any /dev/nbd0pX files, despite the main device will work properly. Check the following discussion on Gentoo forums to see people met this trouble. – firegurafiku Jun 11 '15 at 16:54
  • 2
    This worked great. Note that installing qemu-kvm instead of qemu may work just as well. It did for me on my Ububtu 16.04, and installed only 23MB and 13 dependencies instead of 230MB and many more dependencies for the full qemu install. – mivk Jan 21 '18 at 21:39
  • 1
    On Debian buster amd64 I installed only ~qemu-utils~ and its dependencies, for a total of just a few MB of disk usage, and it worked: I successfully mounted the .vdi and copied one file. – Jorge Mar 20 '18 at 14:12
  • 3
    I'd like to add that apparently sudo partprobe needs to be executed with newer kernels so that /dev/nbd0p* are created in Debian/Ubuntu (bugs.debian.org/cgi-bin/bugreport.cgi?bug=824553). – Kai Apr 10 '18 at 20:56
  • 2
    This should be the accepted answer!! My vdi is too big to convert to an .iso on my hard drive. After struggling for a while, I scrolled down to see if any other methods used the vdi directly. This one is simple. (Note: qemu takes about 300MB for those of us who care about our hard drive filling up.) – psitae May 26 '18 at 11:17

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
  • 1
    @mattwilkie: The difference now: no manual compile required anymore – stwissel May 9 '12 at 2:20
  • 1
    You are welcome. Sitting at a propper screen/keyboard instead of pecking on glas made all the difference :-) – stwissel May 10 '12 at 3:15
  • 5
    It's not available in 14.04. – int_ua Aug 9 '14 at 20:14
  • 2
    One can download it from here: sourceforge.net/projects/vdfuse/?source=typ_redirect and it works (on 15.04) – sup May 13 '15 at 14:17
  • 6
    No longer valid for 16.10, package no longer exists. – Piskvor left the building Dec 14 '16 at 13:13

Set the disk as secondary master for another virtual OS, then boot into this (virtual) OS and you can mount it.

Step 1: Assuming you have a virtual os(say Ubuntu 16.04) already installed in Virtual box, add a new storage from settings of that virtual os. enter image description here

Step 2: Browse the Vdi file you want to access and select it.

Step 3: Logon to the virtual OS.

Step 4: The virtual disk will probably be available inside the OS. If not, follow step 5

Step 5: Inside the virtual OS, use Gparted and check the disks. and ensure the disk is of type which is accessible by the virtual OS. If it is not, you may have to edit the disk, but then you will lose the existing contents.

  • 1
    For the record, in 2016 it won't work – Paulo Pedroso Feb 25 '16 at 10:16
  • 1
    It works in ubuntu 16.04. – Sharun Dec 12 '16 at 7:56
  • this is really the only solution when you need to make changes and then go back to using it, couldn't get rw working with vdfuse – DuBistKomisch Mar 28 '18 at 9:07
  • you can even use a live ubuntu and add the .vdi file as extra strorage. – AmirHossein Rezaei Mar 30 '20 at 16:53

I haven't tested myself but there is a fuse module to mount them (vdfuse), check the following page:

Please note that using it for write access is risky.


$ ./vdfuse-v<version> -h
USAGE: ./vdfuse [options] -f image-file mountpoint
   -h   help
   -r   readonly
   -t   specify type (VDI, VMDK, VHD, or raw; default: auto)
   -f   VDimage file
   -a   allow all users to read disk
   -w   allow all users to read and write to disk
   -g   run in foreground
   -v   verbose
   -d   debug

To mount an image directly using its filename:

$ ./vdfuse-v<version> -f image.vdi /mnt/vdi
$ mount -o loop /mnt/vdi/Partition1 /mnt/WindowsXP

To mount an machine disk (including snapshots):

$ ./vdautomount-<version> -p /path/to/vdfuse WinXP /mnt/vdi
$ mount -o loop /mnt/vdi/Partition1 /mnt/WindowsXP

As Vojtech Trefny mentioned above,

1) first convert your VDI -> IMG

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

2) Then mount the IMG

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

3) However, as I got this error message:

mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

and dmesg said:

[3105578.013671] EXT4-fs (loop0): VFS: Can't find ext3 filesystem

you need to check out the partition structure of the .img:

fdisk -l ubuntu.img

Disk ubuntu.img: 21.0 GB, 20971520000 bytes
255 heads, 63 sectors/track, 2549 cylinders, total 40960000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf45bc910

   Device Boot      Start         End      Blocks   Id  System
ubuntu.img1   *        2048    12582911     6290432   83  Linux
ubuntu.img2        12584958    16775167     2095105    5  Extended
ubuntu.img3        16775168    40959999    12092416   83  Linux
ubuntu.img5        12584960    16775167     2095104   82  Linux swap / Solaris

4) As you can see, the main partition is starting at bytes 16775168. However, note that the sector size is 512 bytes, so you need to multiply the results 16775168 x 512 = 8588886016 so you need to offset the mount like this:

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

5) Actually this didn't work for me in case where the filesystem was dirty after resize. In this case I further did this:

dd if=ubuntu.img of=ubuntu.disk bs=512 skip=16775168 count=12092416
e2fsck ubuntu.disk
mount ubuntu.disk /mnt
  • 1
    This isn't an answer to the question. You had another problem -- a corrupt image. You should have self-answered a new question. – I Support The Boycott Jun 8 '18 at 4:44
  • 1
    This expands to the previous answer covering the error case. Corrupt image was one use case. +1 for many new tricks. – FractalSpace Dec 27 '18 at 21:03

Not what you requested, but if it's just a matter of getting files off of the vdi, and you want a very quick solution:

  1. Run an ssh server on your host (apt-get install openssh-server && service ssh restart)
  2. Use VirtualBox to build a virtual machine from the existing vdi file, then boot up that virtual machine. (I just kept the default Network Adapter (NAT) when building the VM.)
  3. Within the virtual machine, sftp to your host. (sftp hostuser@hostip)
  4. In the sftp session, put as many files to the host as you need.
  • 1
    An ugly hack, but if you're in a tight spot, it gets the job done. – Piskvor left the building Dec 14 '16 at 13:13
  • One problem may be that the machine doesn't currently boot correctly so you'd need to fix that problem first and that means you can't do it from within. Also using SSH with your virtualbox OSes is the way to go to copy files around. Way faster than trying to share a disk. – Alexis Wilke Jun 23 '18 at 23:21

You can use vboximg-mount program which is a part of the VirtualBox's command line tools.


The qemu approach from this answer needed to be modified a bit to work in Ubuntu 20.04.1. First I had to load the nbd module, by:

lsmod | grep nbd
modprobe nbd

This did not work:

sudo mount /dev/nbd0p1 /mnt

I needed to do this instead:

sudo mount /dev/nbd0p2 /mnt
  • What does sudo fdisk -l /dev/nbd0 show? After the modprobe command, you need to run sudo qemu-nbd --connect=/dev/nbd0 /path/to/your/image-file. – ajgringo619 Nov 28 '20 at 19:17

P7Zip will open VDI files

  • Install P7Zip-Desktop from Ubuntu Software.

  • Open folder containing VDI file in Nautilus, (Files).

  • Right click VDI file and select Open with Other Application.

  • Select P7Zip Desktop.

  • Double click the VDI file in the P7Zip window.

  • View or extract files as you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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