Re: Setting up ZFS L2ARC on a zvol

From: David Christensen <dpchrist_at_holgerdanske.com>
Date: Sat, 05 Nov 2022 17:39:53 UTC
On 10/26/22 06:32, julio@meroh.net wrote:
> 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!


ZPOOLCONCEPTS(7) for both 12.3-R [1] and 13.1-R [2]:

"Virtual devices cannot be nested, so a mirror or raidz virtual device
can only contain files	or disks.  Mirrors of mirrors (or other
combinations) are not allowed.


David


[1] 
https://www.freebsd.org/cgi/man.cgi?query=zpoolconcepts&apropos=0&sektion=0&manpath=FreeBSD+12.3-RELEASE+and+Ports&arch=default&format=html

[2] 
https://www.freebsd.org/cgi/man.cgi?query=zpoolconcepts&apropos=0&sektion=0&manpath=FreeBSD+13.1-RELEASE+and+Ports&arch=default&format=html