Hyper-V disk I/O: performance of dynamic vs fixed virtual hard disks

The dynamic virtual hard drive is one of the best things about virtualization. It is like Dr Who’s Tardis. The virtualized OS thinks it has plenty of space, while on the host machine your 128GB virtual drive might occupy just 4 or 5GB – this is typical of the test VMs I set up, running say Server 2008 and a server application or two.

Trouble is, there’s a performance penalty. I first came across this with a hilariously slow Ubuntu install, where the problem is made worse by the lack of integration services, the utilities and drivers that install into the guest to enable smooth interaction with the host.

As an experiment, I created a second Ubuntu VM using a 30GB fixed-size drive. Better? Yes, much better. Here are the figures on my admittedly slow low-end HP Xeon server:

Copy an 891MB file:

Ubuntu 8.10 on 127GB dynamic drive with 1GB RAM: 6 min 45 secs

Ubuntu 8.10 on 30GB fixed drive with 1GB RAM: 3 min 15 secs

As a further test, I copied the same file in Server 2008:

Server 2008 on 127GB dynamic drive with 2GB RAM: 5 min 55 secs

My immediate thoughts: you would be crazy to use VMs in production with dynamic drives. Always use fixed drives. You can still expand them manually if necessary. Note that Hyper-V defaults to dynamic drives.

Still, these tests are not extensive or rigorous; I’d be interested in other results. I’ll also be creating my next Server 2008 VM on a fixed drive and will repeat the test there.

I have to agree with your findings, in all the VM software I have used, fixed drives have always outperformed dynamic drives. Also, if you are smart, defragging the host system disc prior to creating the fixed drive may help ensure the VM disc image occupies contiguous disc space.

So for production servers, they should always be set as fixed drives. Even with a VM, treating a production system as if it was a real physical server is no bad thing. Of course, for production servers, you would also ideally have every VM on it’s own drive spindle to reduce contention, which naturally leads to fixed sized virtual images.