How do I mount .vhd file?

sudo apt-get install virtualbox-fuse
sudo mkdir /mnt/vhd-disk/
sudo vdfuse -f disk.vhd /mnt/vhd-disk/
sudo mount -o loop  /mnt/vhd-disk/Partition1 /mnt/partition1

Note that you may need additional options to mount to set permissions to your liking.


Using Ubuntu 15.10 (works also on Ubuntu 16.04), you can install vhdimount and tsk (The Sleuth Kit) via:

sudo apt-get install libvhdi-utils sleuthkit

Then you can proceed as follows:

sudo mkdir -v /mnt/vhd
sudo vhdimount -X allow_root /path/to/file.vhd /mnt/vhd/
sudo mmls -aB /mnt/vhd/vhdi1

Next, you'll have to calculate the offset from the output of mmls like this:

echo offset*512 | bc

And to finish:

sudo mkdir -v /media/${USER}/your/folder
sudo mount -vt ntfs-3g -o ro,noload,offset=offset-found /mnt/vhd/vhdi1 /media/${USER}/your/folder

Replace offset-found by your offset. You may also have to change the fs-type according to the fs-type included in your vhd file.

I've made a script so I don't have to type this every time ;)


Searching Ubuntu's Launchpad space, the following comes up:

virtualbox (The binary 'virtualbox-fuse' is part of the virtualbox package)

This means that they merged virtualbox-fuse into the main package and you just need to install virtualbox from the repository (This is what used to be called virtualbox-ose, so if you need the PUEL licensed "full" version, this won't help you.)