Setting up ZFS L2ARC on a zvol

From: <julio_at_meroh.net>
Date: Wed, 26 Oct 2022 13:32:48 UTC
Hello,

I'm setting up a new machine in which I have an NVMe drive and a bunch of hard disks. The hard disks are going to be a ZFS pool and the NVMe drive is going to be the root file system + the L2ARC for the pool.

Now... I'm considering using ZFS as well for the root file system (as a separate single-drive pool) in order to simplify admin operations: I want to host some VMs on the NVMe for speed, and using zvols will be very helpful as I don't have to come up with the partition sizes upfront.

And here comes the question: can the L2ARC of the hard disk pool be backed by a zvol on the NVMe pool (again, so that I don't have to use fixed-size partitions)?

I gave a simple try to this setup and it's not working, so I'm wondering if this is just not a good idea and thus is unsupported, or if there is a bug:

root@think:~ # zfs create -V 16G -o primarycache=none zroot/l2arg
root@think:~ # zpool add scratch cache zvol/zroot/l2arc
cannot add to 'scratch': no such pool or dataset
root@think:~ # Oct 26 05:45:28 think ZFS[3677]: vdev problem, zpool=scratch path=/dev/zvol/zroot/l2arc type=ereport.fs.zfs.vdev.open_failed
root@think:~ # ls /dev/zvol/zroot/l2arc
/dev/zvol/zroot/l2arc

Thanks!