Create a ZFS storage with SSD cache in Proxmox

How to add an SSD as a read cache to a ZFS pool in Proxmox with just two commands to speed up storage performance.

ZFS storage spaces can be boosted with an SSD cache. Two commands are all it takes to create a cache… !

A quick and simple tip for everyone who owns ZFS pools and SSDs. If you want to add an SSD that’s sitting idle in your PC, here’s the command to run:

bash
sudo zpool create -f -o ashift=12 nom-zpool /dev/sdxxx cache /dev/sdyyy

Example: sudo zpool create -f -o ashift=12 pool1 /dev/sda cache /dev/sdb

Explanations:

  • « zpool create -f -o ashift =12 nom-zpool » = Creates a new ZFS storage space named « nom-zpool ». The « -o ashift=12 » parameter is the default option – used in the vast majority of cases, it ensures good alignment on the disk (4K sectors). More info in the OpenZFS documentation .
  • « /dev/sdxxx » is the disk on which you want to create the ZFS partition/pool
  • « cache /dev/sdyyy » is the SSD that will serve as the cache. It therefore won’t be usable on its own.

To add the ZFS pool to Proxmox, run the command below:

bash
sudo pvesm set nom-zpool --disable 0

« –disable 0 » is required to enable the pool and make it visible in Proxmox. Mounting is automatic, there’s no need to do anything else.