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?

share|improve this question
    
I just did this same thing, and my search results ended in that you could convert the vdi to a raw image – zeitue May 14 '13 at 6:35
    
boo. that is not a good solution when a vhd or vdi file can be way too large to make a duplicate of as a raw image – Joshua Robison May 15 '13 at 14:12
1  
So, if i install virtualbox i can use vdfuse command? – user426851 Jul 6 '15 at 7:21

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

share|improve this answer
    
This mounts it as read only. What can I do to mount it with write permissions? Omitting the ro for mount still results in read only. – Mads Skjern Mar 12 '17 at 20:22
    
Change ro by rw and that should run in read/write instead of read/only. vhdimount maps to /mnt/vhd/vhdi1 in read/write mode but the next command using mount is in read/only if you don't specify rw as an option – Jiab77 Apr 1 '17 at 10:14

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

share|improve this answer
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.

share|improve this answer

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 virtualbox

Once it finishes installing, go ahead and create a new virtual machine

enter image description here

Type in the name. Make sure that you choose the correct type, and version of the OS that is in the VHD.

enter image description here

Choose use an existing virtual hard drive file, and browse for your VHD file, and then click on create.

enter image description here

share|improve this answer
    
That will let you run the OS that is on the VHD, but it does not allow you to mount the image in Linux. – IQAndreas Feb 8 '16 at 14:43
up vote 1 down vote accepted

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.

share|improve this answer
6  
Then what? How do you mount a VHD after installing that? – Enkouyami Oct 4 '13 at 0:21

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 0

These 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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.