Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

KVM/qemu support various types of cache - none, writethrough, writeback.

How to check which one is default and is used on system when no cache= is specified?

For RHEL6 i found that it's writethrough - but for example for sles sometimes it's writeback.

share|improve this question

1 Answer 1

That depends on what kvm version and what flavour you run. See e.g. https://www.suse.com/documentation/sles11/book_kvm/data/sect1_1_chapter_book_kvm.html where it says:

cache mode unspecified

In qemu-kvm versions older than v1.2 (eg SLES11 SP2), not specifying a cache mode meant that writethrough would be used as the default.

http://wiki.qemu.org/ChangeLog/1.2#Block_devices states:

Block devices

[...]

  • The default cache mode for images is now writeback.

For some recommendations between the various modes see e.g.

share|improve this answer
    
Interesting links, but... it doesn't answer to question :-) I know that knowing distribution, version of kvm, environment - it's possible to check in documentation (or sources) what is default. But - how to check it "online"? Having only host and running guest. –  undefine May 3 at 21:43
    
Uhmmm by checking the qemu version via e.g. qemu-kvm --version ? If you're below 1.2 then the default is writethrough, starting with 1.2 the default is writeback. If your question is how to query this for a running VM or un the underlying host, that's probably not that easy and highly depends on how you start the VM. Do you use qemu directly, do you use virsh, do you use virt-viewer ... ? –  doktor5000 May 4 at 23:05
    
Is your question still not fully answered? Please specify what exactly you're missing. For running VMs you could try to query them via QMP (qemu monitor protocol), see some explanations at kashyapc.com/2013/03/31/… or unix.stackexchange.com/a/140927/83329 –  doktor5000 May 10 at 12:43
    
I have machine with sime running kvm's. I would like to know which cache mode is used, when (for example) definition of disk is: -device virtio-blk-pci,drive=hotdisk-XXX-pci-4,id=hotdisk-XXX-pci-4,bus=pci.0,addr=0x4 -drive file=/var/run/ganeti/instance-disks/XXX:0,format=raw,if=none,id=hotdisk-XXX-pci-‌​4,bus=0,unit=4 (there is no "cache=" definition in it). If there is possible to get this information via monitor or qmp - please give me some details :-) - i don't see such option. –  undefine May 11 at 12:51
    
If you do not explicitly specify the cache mode, the quotes from my answer apply as you're using the defaults the. Seems it cannot currently be queried directly if I interpret wiki.qemu.org/Features/Block/… correctly. You might want to ask on the qemu mailing list about this if you are interested. –  doktor5000 May 11 at 18:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.