How to mount Virtualbox drive image(vdi) on Ubuntu 16.10/20.04

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

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

参考链接


发布者

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注