# QEMU:  Slow disk IO

## therealjrd

Hi experts.

I know this topic has come up a bunch of times before.  I've read numerous posts in this forum and other places about how to get decent disk performance running guests in qemu, but so far I haven't found the right combination.

A few factoids:

Host is a Dell 755 with an Intel Core Duo E6550 processor.  Currently running a gentoo 4.1.2 kernel.  I've enabled kvm and virtio drivers.

I've tried a number of guest configs, again with virtio enabled.  At the moment my guest is running a stripped-down 4.1.12 kernel, no modules.  

I've tried qcow and raw formats for the image files, both are slow; raw is slightly less slow.

On the qemu invocation, I specify the disk as -drive file=disk.raw,format=raw,cache=none,if=virtio.  The device does show up in the guest as /dev/vda.  I'm using io scheduler no-op on the guest.

Disk performance is still terrible.  It takes hours for the guest to run through package dependencies when I emerge world.  Compiling a big-ish package like gcc takes a couple of days.

I'm stumped.  What else should I be looking at?

Thanks in advance.

----------

## frostschutz

Create a block device with LVM. That way, you don't have to go through the filesystem layer of the OS, which adds a ton of overhead.

If the VM has enough RAM you could build stuff in a tmpfs. If that's still slow it has nothing to do with disk I/O as it happens in RAM.

Maybe you got a slow CPU. If in doubt, try -cpu host. Note that this will mess with the compiler settings if you are running with -march=native and the produced binaries will not work if you switch the host platform.

----------

## Ant P.

It might be faster to use 9p or NFS to the host.

----------

## therealjrd

I'm an idiot.

I went back to square one and started checking config.  I had somehow managed to turn off the virtualization flags in my host BIOS.  I have no idea why it ran at all  :Smile: 

Now my x86_64 vm is working great.  The x86 one is still fairly slow, I'm pretty sure that's because I haven't found a good -cpu setting yet.

Thanks everyone for your ideas!  Next time I'll do a more thorough background check before posting.

----------

## Ant P.

 *therealjrd wrote:*   

> Now my x86_64 vm is working great.  The x86 one is still fairly slow, I'm pretty sure that's because I haven't found a good -cpu setting yet.

 

Use the same one for both? The only difference is the software.

----------

