1

I need to mount virtualbox dynamic vdi image on Debian 8 system.

There is 2 ways to solve this task:

  1. To use vdfuse. But it was removed from D8 repo, though it exists for D7 wheezy and I use it on wheezy. I tried to compile vdfuse from source from oracle, but it won't.
  2. To use qemu-nbd. This does not work for me too. qemu-nbd mounts vdi image to /dev/nbd0 device. But thre is no partitions that could be mounted as block diveces. I suppose this is because of dynamic vdi image.

Here is the similar thread https://askubuntu.com/questions/19430/mount-a-virtualbox-drive-image-vdi and it was not helpfull for me.

On Debian 7 everithing is ok and vdfuse could be installed from repo, why it's a problem on Jessie?

Any way out?

2

PLEASE NOTE If you already have the Debian 8 version of VirtualBox installed this may not work. If you need VirtualBox installed and working for other virtual images this may break that.

You can manually install the wheezy versions of the required packages.

Download the following .debs for your architecture:

Use dpkg -i to install them in the order they were downloaded.

Then, follow the below steps, taken from this tutorial page (which is the same for a dynamic VDI, I tested both), to mount a VHD/VDI.

  1. Create a mount point for the image

    # mkdir /mnt/VHD
    
  2. Open the image file to the mount point

    # vdfuse  -w  -f  <path to vhd image>  /mnt/VHD/
  3. List the contents of the vhd/vdi image

    # ls -l /mnt/VHD/
    

    This will show either

    EntireDisk

    or

    EntireDisk
    Partition1Partitionx
  4. Create mount point(s) for the extracted image(s)

    # mkdir /mnt/mydiskP1
        ︙
    # mkdir /mnt/mydiskPx
  5. And mount

    # mount /mnt/VHD/Partition1 /mnt/mydiskP1
    # ls -l /mny/mydiskP1
    

When you are done you have to umount everything in reverse order

umount /mnt/mydiskP1
umount /mnt/VHD

NOTE The partition layout of your image file may be different than described. If this is the case then Googling "linux mount disk image" is your friend.

  • Welcome to Unix & Linux Stack Exchange.  While this tutorial may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.  Link-only answers can become invalid if the linked page changes. – G-Man Apr 30 '16 at 17:37
  • Edited to avoid link rot. Thanks @G-Man – Phorce1 Apr 30 '16 at 18:40
0
  1. Load nbd module

    modprobe nbd max_part=16

  2. Map vhd to system

    qemu-nbd -c /dev/nbd0 image.qcow2

  3. View partition in vhd

    fdisk -l

  4. Mount the partition you want

    mount /dev/nbd0p1 /mnt

Full step by step: https://www.youtube.com/watch?v=zIpvNoJmVRs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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