Tuning qcow2 L2 Cache Size for optimal performance

cuhanhtuoi

New Member
Jun 26, 2026
2
2
3
In a some previous posts, I found that we had discussed how increasing the L2 cache size can improve qcow2 disk performance. However, there wasn't a clear set of instructions explaining how to implement this change. Therefore, I decided to create a simple and straightforward guide to make the process easier to follow.

For this test, I first created a 2 TB qcow2 disk on top of an LVM volume, as my environment uses a SAN iSCSI LUN mapping. After benchmarking the disk, I observed that the performance was significantly lower than that of a raw disk, highlighting the overhead introduced by the qcow2 format.
1783439172249.png
Next, power off the VM and SSH into the Proxmox host that contains it. Locate the VM configuration file at:
Code:
/etc/pve/qemu-server/<VM_ID>.conf
Edit the configuration file and add the following line at the end. Replace l2-cache-size with the desired cache size and specify the path to your qcow2 disk file:
Code:
args: -blockdev qcow2,node-name=qcow2-cache-override,l2-cache-size=268435456,file.driver=host_device,file.filename=/dev/LVM-LUN-01/vm-112-disk-0.qcow2
View attachment 98841
After applying the L2 cache size change and restarting the VM, the performance improved significantly. Benchmark results showed that the qcow2 disk now performs at a level comparable to a raw disk.
1783439180273.png
 

Attachments

  • 1783439164901.png
    1783439164901.png
    54.3 KB · Views: 6
  • Like
Reactions: robertlukan