terça-feira, 22 de novembro de 2011

Convert Virtualbox vdi to KVM (qcow)

Modo 1)

Execute:

# qemu-img convert Linux.vmdk -O raw Linux.img

do servidor KVM com os pacotes de virtualização instalados.

Para editar o tamanho do HD Virtual KVM:

sudo qemu-img resize /var/lib/libvirt/images/myvm.img 255G



Modo 2)

I have been asked several times how to convert an existing VirtualBox machine / image to KVM. The process is quite easy and involves simply converting your virtual hard drive (VirtualBox uses "vdi") to a format compatible with KVM (qcow). You then use the qcow image with KVM, either from the command line of with virt-manager.


Although the process is quite easy, it does require sufficient hard drive space as the VirtualBox .vdi is first converted to a raw disk image.
Side track – Both vdi and qcow images are compressed, so a a 10 Gb .vid or .qcow will take less space on your hard drive. Conversion, however, requires you to first convert the .vdi to a raw image, which will require the full 10 Gb, so plan accordingly.
Assume your VirtualBox image is called "ubuntu.vdi"


Step 1. Convert the VB disk vdi image to a raw image format.


VBoxManage clonehd --format RAW ubuntu.vdi ubuntu.img
Note: The ubunut.img is a raw disk image, it will be quite large (as many GB as your virtual drive is, see above).


Step 2 : convert the raw image to a qcow


qemu-img convert -f raw ubuntu.img -O qcow2 ubuntu.qcow

That is all there is to it, the ubuntu.qcow can be used with KVM.
Test your new image (ubuntu.qcow) with:


kvm -m 512 -usbdevice tablet -hda ubuntu.qcow
If it is working you may delete the raw image (ubuntu.img) and archive or delete the ubuntu.vdi .



Welcome to KVM :)

Nenhum comentário:

Postar um comentário