Is it possible to mount vdi like for example iso? Or open it with some archive program? If yes, how?

edit: My vdi is dynamically expanding storage and i have snapshots too.

  • 1
    Is this the subset of a larger problem? Are you trying to access data for a VM you don't want to start for some reason? If it is running and you to access the data, some sort of file sharing from the VM is probably the best solution. – Kyle Brandt Aug 9 '09 at 14:57

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!

  • You may need to run sudo partprobe /dev/nbd0 to see partitions of your virtual drive. – mymedia Dec 16 '18 at 18:03

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.

  • what do you mean by static in this case? – Phil Aug 9 '09 at 13:21
  • Oh. It's dynamically expanding storage. – Phil Aug 9 '09 at 14:10
  • Thinking out loud here... would it be possible to create a FUSE filesystem that is VDI aware for read blocks in the dynamically sized disk and then maps the calls to the native filesystem? Once the block structure of the disk image has been attained, it's a matter of reading native FS blocks/data. – EmmEff Aug 9 '09 at 14:44
  • 1
    EmmEff: Someone tried to write fuse module / driver (don't know the term), not sure of its status: forums.virtualbox.org/viewtopic.php?p=59679#59679 – Kyle Brandt Aug 9 '09 at 14:50
  • Looks like that would be the ultimate long-term solution, although it appears to need some work. – EmmEff Aug 9 '09 at 14:53

If we knew why you wanted this you might get better answers. Is virtualbox no longer working? Are you trying to get faster transfers to the virtual?

Simplest method for dynamic + snapshots without "running" the virtual is to boot the virtual to a livecd iso image. Then you can use sshfs, smbfs, nfs, etc. to mount the running virtual machine's drive(s) on the host.

If static and no snapshots you could also leave the disk in vmware format (virtualbox supports it) and mount using vmware's vmmount.pl.

If transfer speed is the issue make sure your host and virtuals are in the host's and virtual's host files or have name resolution through another method. (DNS, etc.)

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.