HOWTO: Mount any VBox-compatible disk image on the host

This tutorial will show you how to mount any VDI, VMDK, or VHD disk file on the host system! Things you need to get started:
If you don't have the virtualbox sources (see the VirtualBox Downloads page "Open Source Edition (OSE) Source code") and don't want the full sources then get them using subversion:
3. Compile it.
To mount an image directly using its filename:
To mount an machine disk (including snapshots)
Please note that whilst we use this program regularly, any use by you is at your own risk. If you don't trust this program, use the -r (readonly) flag.
This program presents a virtual disk as a Filesystem in User Space (FUSE). The separate partitions appear as block files Partition1, ... under the mount point. You can then mount any or all of the partitions as a Loop Device. If you use the readonly flag then these files are readonly and the partitions themselves can only be mounted readonly. If you want to understand more then follow the referenced links to the Wikipedia articles or read the source; you will see that the vdfuse application itself does very little other than glue the fuse handler to the VirtualBox Virtual Disk API.
Note that this is a restricted topic. If you want to discussion vdfuse then see the vdfuse discussion.
- gcc version 4 or later
- VirtualBox version 3 or later
- development headers (apt-get install build-essential on Ubuntu / Debian)
- fuse + fuse headers (apt-get install libfuse-dev)
- VirtualBox source OR subversion
If you don't have the virtualbox sources (see the VirtualBox Downloads page "Open Source Edition (OSE) Source code") and don't want the full sources then get them using subversion:
svn co http://www.virtualbox.org/svn/vbox/trunk/include/2. Download vdfuse, its builder, and optionally, vdautomount
3. Compile it.
sh vdbuild /path/to/vbox/headers vdfuse.c4. Run it!
To mount an image directly using its filename:
- Code: Select all Expand viewCollapse view
$ ./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
$ ./vdfuse-v<version> -f image.vdi /mnt/vdi
$ mount -o loop /mnt/vdi/Partition1 /mnt/WindowsXP
To mount an machine disk (including snapshots)
- Code: Select all Expand viewCollapse view
$ ./vdautomount-0.1.txt --help
Usage: vdautomount [options] machine-name-or-uuid mountpoint
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-p vdfuse path to vdfuse
-r readonly
-g run in foreground
-v verbose
-d debug
-a allow all users to read disk
-w allow all users to read and write to disk
-m NUMBER specify which disk to mount, required if machine has more than
one disk
$ ./vdautomount-<version> -p /path/to/vdfuse WinXP /mnt/vdi
$ mount -o loop /mnt/vdi/Partition1 /mnt/WindowsXP
Please note that whilst we use this program regularly, any use by you is at your own risk. If you don't trust this program, use the -r (readonly) flag.
This program presents a virtual disk as a Filesystem in User Space (FUSE). The separate partitions appear as block files Partition1, ... under the mount point. You can then mount any or all of the partitions as a Loop Device. If you use the readonly flag then these files are readonly and the partitions themselves can only be mounted readonly. If you want to understand more then follow the referenced links to the Wikipedia articles or read the source; you will see that the vdfuse application itself does very little other than glue the fuse handler to the VirtualBox Virtual Disk API.
Note that this is a restricted topic. If you want to discussion vdfuse then see the vdfuse discussion.