Sunday, July 24, 2011

Mount Virtual Box Image in Ubuntu

VirtualBox provides a tool called vdfuse, which is a FUSE-based filesystem package that can mount any VirtualBox VDI image.It support VDI, VMDK, VHD and raw format

Install vdfuse package using the following command

$ sudo apt-get install virtualbox-ose-fuse

You can now mount the VDI file like this:

$ sudo vdfuse [options] -f /path/to/file.vdi /path/to/mountpoint

The options are

-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

This command creates file like 'EntireDisk', 'Partition1', etc at the mount point.

To mount the filesystem, just use:

mount /path/to/mountpoint/Partition1 /path/to/someother/mountpoint

Then view the file system at /path/to/someother/mountpoint