Ok, going back to your specific questions:
1. Where are data cached when using ZFS (RAIDZ) and "none", "writeback" or "unsafe" at VM's disk cache?
ZFS does this within the ZIO pipeline (in host memory) for all write operations - this is before the record is assembled then becomes the TXG which is flushed syncronously. Semantically I myself would say buffered rather than cached at this stage. Therefore all these 3 options of "none" "writeback"
and "unsafe" effectively will cause double caching to take place by ZFS and separately by some onboard disk write cache buffer.
When using ZFS, you only want directsync. This is why I always use disks and choose smallest onboard write cache, as ZFS is effectively ignoring/bypassing this entirely. It goes RAM -> straight to disk.
2. Where are data cached when using Hardware RAID and "none", "writeback" or "unsafe" at VM's disk cache?
The host RAM is not used ( For writes this is ). Only within whatever memory is available to the Hardware RAID controller, usually being; 2G, 4G, or 8G onboard and or the disk buffer. Subsequent reads will be from ZFS ARC if using this ... combo.
3. The hardware RAID controller does have similar options (writeback, write through), but what’s configured at VM's disk cache does not change the behaviour at hardware RAID controller, right? - Correct, this cannot change the configured controller setting.
Seems to have been asked elsewhere, this may help too. Perhaps I can look to help them update this doc in some form:
-
https://forum.proxmox.com/threads/disk-cache-wiki-documentation.125775/
If this is more about obtaining better performance:
"A SCSI controller of type
VirtIO SCSI single and enabling the IO Thread setting for the attached disks is recommended if you aim for performance. This is the default for newly created Linux VMs since Proxmox VE 7.3. Each disk will have its own
VirtIO SCSI controller,and QEMU will handle the disks IO in a dedicated thread." - ( this is a per VM setting )
It looks like Disk Cache modes are dependent of the specific hardware used, I myself cannot see any options on these in my setup in the GUI console. Where can I see those? I just use ZFS for everything as you can maybe tell.