Change IDE to VirtIO Disk in KVM

I want to show you how to change an IDE disk to a VirtIO disk in an already done guest. In my example it is a FreeBSD 10.3 guest:

First open your guest's /etc/fstab and change:

all /dev/ada0pX to /dev/vtbd0pX (FreeBSD only)
all /dev/sdaX to /dev/vdaX (Linux only)

Now shutdown the guest and connect to your KVM host's shell. Then type:

# virsh edit <SERVER_DOMAIN>

find following line:

<disk type='file' device='disk'>
    ...
    <target dev='hda' bus='ide'/>
    ...
</disk>

and change it to

<target dev='vda' bus='virtio'/>

also remove all occurance of "<address type=…" within the same disk section. On save KVM will regenerate the line for you. Note that this part is needed for correct disk values wihtin the guest!

Now restart your guest and everything should be running.

# virsh start >SERVER_DOMAIN>

PLEASE NOTE: This method has worked for me on any Linux/FreeBSD guest but apparently there were some windows installations were this method broke the MBR, so please do a backup first!