virtual disk default "No cache" settings weirdness

RolandK

Famous Member
Mar 5, 2019
1,081
267
128
52
When I look at promox virtual disk settings , the default for virtual disk is „Default (No cache)“.

The wiki page at https://pve.proxmox.com/wiki/Performance_Tweaks is telling :

„cache=none seems to be the best performance and is the default since Proxmox 2.X.“

The file section in the kvm/qemu process (via ps -ef), looks like this, when „Default (No cache)“ is selected :

-drive file=/btrfs-hdd-zstd/vms-raw/images/110/vm-110-disk-0/disk.raw,if=none,id=drive-scsi0,aio=threads,format=raw,detect-zeroes=on

We see, that there is no cache=…. setting in the qemu command.

Setting „Default (No cache)“ seems to be different from setting „No cache“. When „No cache“ is being selected, then cache=none is explicitly added to the process/commandline.

The qemu manpage at https://www.qemu.org/docs/master/system/qemu-manpage.html is telling:

„The default mode is cache=writeback.“

doesn't that mean, if "no cache setting is applied to the -drive option/commandline, then „writeback“ should be active !?

I found this weirdness while playing around with the settings, as I gut csum corruption on BTRFS, which does apparently happen when using direct-I/O with btrfs.

When I set „Default (No cache)“ I get no csum errors on virtual disk migration, when is set „No cache“ explicitly, then I get csum errors.

that means setting "Default (No cache)" and "No cache" is not the same!?
 
> Setting „Default (No cache)“ seems to be different from setting „No cache“. When „No cache“ is being selected, then cache=none is explicitly added to the process/commandline.

apparently, this seems to be only case when the VM/disk is placed on btrfs,

i found this quirk in the source, i.e. cache=none seems not to be set when datastore is btrfs (i.e. type btrfs, not dir on top of btrfs)

https://github.com/proxmox/qemu-server/commit/0fe779a62cb4755b74fe83e8323495ee03d0176c

but how can pve show "Default (No cache)“ when in reality, it's using a different setting under the hood?

i think applying silent quirks which affect caching/data safety and which show wrong information to the end user is not a very optimal way to go.

i would at least expect a warning message and some mention in the proxmox docs/wiki.
 
Last edited: