Page 1 of 1

[SOLVED]Qemu disk cache problem

Posted: Tue Nov 29, 2011 3:08 am
by Muneer
Hi,

I am using Lubuntu 11.04 with qemu. My Os loads applications from a fat32 file system. I pass the physical drive as the disk to qemu i.e -hda /dev/sda and my os does the directory parsing, reading etc.. But every change I make to the file system from the host is not shown in my Os until next reboot. I think it maybe that qemu internally caches disk accesses. So do anyone know of a solution or argument that I can pass to qemu to disable the cache. "cache=none" does not seem to work. Qemu documentation says that qemu may still internally cache even if that argument is passed. Rebooting every time I edit the applications for my Os defeats one of the main advantage of a virtual machine.

Re: Qemu disk cache problem

Posted: Tue Nov 29, 2011 3:13 am
by bluemoon
It is possible that your changes to /dev/sda is not commited by the Linux itself.
Try sync

Re: Qemu disk cache problem

Posted: Tue Nov 29, 2011 3:25 am
by Muneer
Sorry for not mentioning it. I do unmounting and then mounting again the partition after an edit in the host. I did check it with a bunch of other utilities just to ensure whether it is the Linux itself that is caching or the qemu. And I did try sync before posting the question. It seems qemu is the culprit.

Re: Qemu disk cache problem

Posted: Tue Nov 29, 2011 4:07 am
by Muneer
Found it. You have to pass the below arguement to qemu to disable guest disk caching and actually make qemu
wait on the disk IO.
qemu -drive file=/dev/sda,index=0,cache=none
instead of -hda /dev/sda