Posts

Showing posts from July, 2012

Mounting and converting vdi and qcow2 image files

1. Convert VirtualBox VDI disk file for use with KVM $ qemu-img convert -O qcow2 diskname.vdi newdiskname.qcow2 2. Mounting raw disk images #  losetup /dev/loop0 image.img # kpartx -a /dev/loop0 # mount /dev/mapper/loop0p1 /mnt/image 3. Mount qcow2 disk images # modprobe nbd max_part=63 # qemu-nbd -c /dev/nbd0 image.img # mount /dev/nbd0p1 /mnt/image Optional: LVM Scaning for LVM on disk images: # vgscan #   vgchange -ay  VolGroupName #   mount /dev/VolGroupName/LogVolName /mnt/image Finishing: # umount /mnt/image #   vgchange -an VolGroupName #   killall qemu-nbd #   kpartx -d /dev/loop0 #   losetup -d /dev/loop0 From:  http://jaysonrowe.blogspot.com.br/2011/10/convert-virtualbox-vdi-disk-for-use.html From:  http://alexeytorkhov.blogspot.com.br/2009/09/mounting-raw-and-qcow2-vm-disk-images.html