Archive for October, 2015

How To Mount Virtualbox VDI With LVM Partition On Ubuntu

October 1, 2015 Leave a comment

First, install the QEMU tools. In Ubuntu, you’ll find them in the qemu-kvm package. Whatever package your distribution ships which contains the qemu-nbd binary should be fine and also install the lvm2

sudo apt-get install qemu-kvm

sudo apt-get install lvm2

Load the nbd kernel module. Yes, I’m serious, the network block device module!

sudo modprobe nbd max_part=16

Then run qemu-nbd, which is a user space loopback block device server for QEMU-supported disk images. Basically, it knows all about weird disk image formats, and presents them to the kernel via nbd, and ultimately to the rest of the system as if they were a normal disk.

sudo qemu-nbd -c /dev/nbd0 <vdi_file_location>

Ex: sudo qemu-nbd -c /dev/nbd0 /home/testuser/Desktop/SharedFolder/xubuntu_1404-disk2.vdi

Re-read The Partition Table Without Rebooting Linux System using partprobe command

sudo partprobe /dev/nbd0

Once installed, run pvscan to scan all disks for physical volume. this to make sure your LVM harddisk is detected by Ubuntu


After that run vgscan to scan disks for volume groups.


Reading all physical volumes. This may take a while…
Found volume group “VolGroup00” using metadata type lvm2

Activate all volume groups available.

vgchange -a y

Run lvscan to scan all disks for logical volume. You can see partitions inside the hard disk now active.

ACTIVE ‘/dev/VolGroup00/LogVol00’ [72.44 GB] inherit
ACTIVE ‘/dev/VolGroup00/LogVol01’ [1.94 GB] inherit

Mount the partition to any directory you want, usually to /mnt
mount /dev/VolGroup00/LogVol00 /mnt

%d bloggers like this: