Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
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
add comment

3 Answers

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.

share|improve this answer
    
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
add comment

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!

share|improve this answer
add comment

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.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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