How do I mount .vhd file?

I'm using 13.04 Raring amd64 and I need to mount a .vhd file on my ubuntu. I've googled about it and found that virtualbox-fuse package is the answer.

But the package was deleted from apt repository. Is there any way to install the package w/ 13.04? or is there any alternative to virtualbox-fuse?


Solution 1:

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.

Solution 2:

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