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?
37 Answers
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/partition1Note 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 sleuthkitThen 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/vhdi1Next, you'll have to calculate the offset from the output of mmls like this:
echo offset*512 | bcAnd 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/folderReplace 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 ;)
3Searching 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.)
I'd prefer not to rely on a VM to access data on a vhd image. Since virtualbox-fuse and vdfuse is no longer available in Ubuntu (not since precise (12.04)) and Debian (not since Wheezy (7)). I was able to mount the NTFS partition of a personal VHD using blk-tap.
Insert the apropriate pid from tap-ctl spawn, of course. Your partitioning scheme may be different from mine, so adjust accordingly.
# apt-get install blktap-utils
# modprobe blktap
# tap-ctl allocate
/dev/xen/blktap-2/tapdev0
# tap-ctl spawn
tapdisk spawned with pid 1234
# tap-ctl attach -m 0 -p 1234
# tap-ctl open -m 0 -p 1234 -a vhd:/full/path/to/image.vhd
# mount /dev/disk/by-id/dm-name-tapdev0p1
# ls -lh do/your/thing with/all/your/files.txt
# tap-ctl close -m 0 -p 1234
# tap-ctl detach -m 0 -p 1234
# tap-ctl free -m 0These steps came from the xen project's wiki.
My block device was created at /dev/xen/blktap-2/blktap0. For some reason, kpartx -a would not map partitions (I was looking for /dev/xen/blktap-2/tapdev0p1), but I found that /dev/disk/by-id/dm-name-tapdev0p1 had been linked to the block device for the partition.
Here is what I did for it:
It seems not there's a smooth way to go. I just downloaded virtualbox-fuse deb package file from launchpad. (here)
I picked 4.1.18 because my vbox is a little bit older but I guess it would works with recent version.
Install the package with dpkg -i. You may need to specify --force-depends option for installing.
I successfully mounted a .vhdx file I made with Windows 10 Backup files to my Ubuntu 16.04 OS using a program called guestmount
guestmount manual page on libguestfs.org.
Note that permissions will need to be adjusted, or mount accessed after sudo -i or sudo -s has been executed.
You can use VirtualBox.
VirtualBox is a free x86 virtualization solution allowing a wide range of x86 operating systems such as Windows, DOS, BSD or Linux to run on a Linux system.
To install VirtualBox Under Ubuntu 13.04, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo apt-get install virtualboxOnce it finishes installing, go ahead and create a new virtual machine
Type in the name. Make sure that you choose the correct type, and version of the OS that is in the VHD.
Choose use an existing virtual hard drive file, and browse for your VHD file, and then click on create.