Contents

Introduction

Virtio block device is a para-virtualized device for kvm guest. It is different from normal emulated hard drive, because it is simply faster. This small how-to is about how to make a disk para-virtualized and boot from it.

Steps

create a disk and install os to it by appending "-hda <your_disk_image>" to your virtual machine

in your guest os, upgrade kernel to 2.6.25 which contains virtio_* drivers. or ubuntu 8.04 also has it.

Error 18

you may experience this error while grub is booting. I solved it by making the /boot the first partition and make it 32MB.

qcow2

I have problem to boot from qcow2 format image, it will hang while kernel booting. you may convert your disk image to raw format by "qemu-img convert -f qcow2 <your_disk_image> -O raw <a_new_location>".

Booting with lilo

You must add this to your lilo.conf:

boot=/dev/vda
disk=/dev/vda bios=0x80 max-partitions=7

and after your image clausule change:

root=/dev/vda1

where vda1 is your boot partition

Updating the initramfs with the virtio driver

If you are using debian then you may want to update your initramfs with the virtio driver as explained in Using VirtIO NIC