侧边栏壁纸
  • 累计撰写 99 篇文章
  • 累计创建 54 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录
PVE

PVE partition passthrough cache policies comparason

FlyingEagle
2025-11-03 / 0 评论 / 0 点赞 / 15 阅读 / 2,361 字

🧠 PVE Disk Cache Cheat Sheet

VM Type / Workload Recommended Cache Mode Why Notes
Windows VM (general desktop, small random I/O) writeback Better write performance; Windows often has less efficient disk caching Slightly higher risk of data loss if host crashes; good with UPS; add iothread=1 and discard=on for SSDs
Linux VM (server workloads, ext4/XFS/ZFS) none Bypasses host cache, Linux handles caching itself efficiently Slightly lower write performance than writeback, safer for integrity; add discard=on for SSDs
Linux VM (high-performance DB, heavy writes, sync important) writeback or directsync Improves throughput while maintaining some safety directsync safer for transactional DBs; writeback for analytical workloads; always use UPS
VM with mostly read workloads none or directsync Avoids double caching; minimal performance impact for reads Almost same performance as writeback for reads; much safer; add discard=on for SSDs
Mixed workloads on SSD/NVMe writeback with iothread Maximizes performance on fast storage iothread helps NVMe most, but also useful for fast SSDs; always use discard=on
Critical Data VM (business essential, cannot lose data) none or writethrough Maximum data integrity and safety writethrough provides read caching with write safety; performance secondary to reliability
Development/Test VM (disposable or frequently backed up) writeback or unsafe Maximum performance for testing unsafe only for truly disposable data; regular backups recommended for writeback

⚙️ Essential Parameters for All Configurations

  • SSD/NVMe: Always add discard=on (enables TRIM)
  • Performance: Always add iothread=1 for virtio-scsi disks
  • Safety: Use UPS, especially with writeback or unsafe modes

🧩 Quick Cache Mode Reference

Cache Mode Description Safety Performance
none Direct disk access, bypasses host cache 🔒 Highest ⚙️ Moderate
writethrough Safe writes + read caching 🔒 High ⚙️ Moderate
directsync Sync writes direct to disk 🔒 High ⚙️ Moderate
writeback Host page cache, delayed flush ⚠️ Medium 🚀 High
unsafe No sync flush, full cache ❌ Very low ⚡ Maximum

💡 Notes for ZFS/Btrfs Users

If your Proxmox storage backend uses ZFS or Btrfs, the cache parameter has minimal effect since these filesystems manage caching internally.
However, cache=none is still the safest and most compatible choice.


✅ Summary

  • Use writeback for performance-sensitive Windows or test workloads.
  • Use none or writethrough for critical data and Linux servers.
  • Always enable discard=on for SSD/NVMe.
  • Always use iothread=1 on high-speed storage.
  • Protect with UPS if using writeback or unsafe.

examples

  • Windows VM
qm set 101 -scsi1 /dev/nvme0n1p2,cache=writeback,discard=on,iothread=1

  • Linux VM
qm set 102 -scsi1 /dev/nvme0n1p3,cache=none,discard=on,iothread=1

0

评论区