14

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?

3
  • 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, 2013 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 May 15, 2013 at 14:12
  • 1
    So, if i install virtualbox i can use vdfuse command?
    – user426851
    Jul 6, 2015 at 7:21

7 Answers 7

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

1
  • It works, you can download vdfuse from vdfuse.sourceforge.net for example in my case the last line was: sudo mount -o -loop /tmp/win/Partition1 /mnt/Windows
    – MaxV
    Dec 7, 2018 at 10:39
4

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

3
  • 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. Mar 12, 2017 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, 2017 at 10:14
  • 1
    In Ubuntu 16.04: Instead of using mmls or fdisk to find out about the starting sector of the partition, you can also use kpartx to create a virtual device file that you can mount without an offset option: sudo kpartx -av /mnt/vhd/vhdi1; sudo mount -vt ntfs-3g -o ro,noload /dev/mapper/loop0p1 /media/${USER}/your/folder
    – slowhand
    Jun 28, 2018 at 19:36
2

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

2

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.

2

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.

1

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.

1
  • 10
    Then what? How do you mount a VHD after installing that? Oct 4, 2013 at 0:21
-1

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

1
  • 2
    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, 2016 at 14:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .