Posts Tagged ‘QEMU’

Running Virtual Machines on KVM and QEMU from command line on Ubuntu 14.04

October 7, 2014 Leave a comment

The aim of this post is to document how to get a Lubuntu 14.04 instance, a Windows 7 instance and an Android-86 instance running on KVM (running on QEMU in most cases).
[NB: This is not yet complete, so it may serve only as pointers and not a full guide…]

Install the prerequisites:

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

Check if Virtualization is supported on your machine (or virtual machine, if you’re trying to nest VMs) using the kvm-ok command

Method 1: Using the libvirt library / package / set of tools:

NB: I used this to get the lubuntu instance running

sudo apt-get install virtinst
sudo virt-install -n testLubuntu -r 512 \
--disk path=/home/USERNAME/Desktop/VMDisks/testLubuntu.img,bus=virtio,size=6 -c \
lubuntu-14.04.iso --network network=default,model=virtio \
--graphics vnc,listen= --noautoconsole -v

Check which VMs are running:

virsh -c qemu:///system list

Stop an instance:

virsh -c qemu:///system shutdown  

NB: Replace the with the name of the instance, e.g. in my case “testLubuntu”
Start an instance:

virsh -c qemu:///system start  

Destroy and undefine an instance:

virsh -c qemu:///system destroy  
virsh -c qemu:///system undefine  

Method 2: Using the kvm package directly:

NB: I used this to get the Android-x86 instance running … but without a WiFI network (as of now…)
Create a virtual disk image file

qemu-img create android-4.4.img 8G

Install the Android OS using a virtualized CD-Rom that points to a bootable Android image:

kvm -m 2048 -hda android-4.4.img -cdrom <Bootable-Android-ISO.iso> -boot d

Create a partition that is bootable and writable when the cfdisk prompts you to do so.

I haven’t been able to get the networking part right because it involves some bridging … which is a bit mind-boggling.



Conversion from KVM qcow2 (from proxmox) to Virtualbox VDI

June 11, 2013 Leave a comment

Method 1:

Convert first from qcow2 to RAW using qemu-utils in an Ubuntu Linux machine

sudo apt-get install qemu-utils
qemu-img convert -f qcow2 <qcow2_VM_filename> -O raw <RAW_file_VM_filename>

Convert from RAW to VDI using VBoxManage on any machine that has Virtualbox Installed

VBoxManage convertfromraw <RAW_file_VM_filename> <VDI_Output_file_VM_filename> \ 
--format vdi

The “\” is just a line-break because the command doesn’t fit in one line on this page

Method 2:

Use qemu-img directly in a Linux machine:

qemu-img convert -f qcow2 <qcow2_VM_filename> -O vdi <RAW_file_VM_filename>

NB: For some strange reason Method 1 worked once and failed the 2nd time, Method 2 was always successful. So i suggest using Method 2