This tutorial will explain How to mount Virtualbox drive image(.vdi) on Ubuntu 16.10.First we need to install QEMU tools using the following command
sudo apt-get install qemu-kvm
Now we need to load the network block device (nbd) module using the following command
sudo modprobe nbd
run qemu-nbd, which is a user space loopback block device server for QEMU-supported disk images.
qemu-nbd -c /dev/nbd0 [vdi-file]
Note:- vdi-file :- Your vdi file location for example /home/test/ubuntu.vdi
Sponsored Link
Example
qemu-nbd -c /dev/nbd0 /home/test/ubuntu.vdi
You can check the partitions in the image using the following command
sudo fdisk -l /dev/nbd0
The above command will check the entire image as a block device named /dev/nbd0, and the partitions within it as subdevices. For example, the first partition in the image will appear as /dev/nbd0p1.
If you want to mount the first partition use the following command
sudo mount /dev/nbd0p1 /mnt
Now you can check all the contents of /mnt partition and copy all the required files.
After completing your work you can unmount the partition using the following command
sudo umount /mnt
Shutdown nbd services using the following command
sudo qemu-nbd -d /dev/nbd0
Thanks for your effort to help, but I needed to do some research, because the partitions did not mount. Then I discovered that you need to modify the following:
sudo modprobe nbd max_part=16
The max_part=16 is important, without it you won’t see the /dev/nbd0p1 part.