A proposal for makefs -t zfs to support more zpool layouts

From: Pat Maddox <pat_at_patmaddox.com>
Date: Wed, 20 Nov 2024 04:43:07 UTC
Here's a valid zpool configuration that makefs -t zfs does not currently support:

truncate -s 100m file.zfs
zpool create -m none my-test-pool $(realpath)/file.zfs
zfs create -o mountpoint=/dataset1 my-test-pool/dataset1
zfs create -o mountpoint=/foo/dataset2 my-test-pool/dataset2
zfs list -r my-test-pool

NAME                    USED  AVAIL  REFER  MOUNTPOINT
my-test-pool            218K  39.8M    24K  none
my-test-pool/dataset1    24K  39.8M    24K  /dataset1
my-test-pool/dataset2    24K  39.8M    24K  /foo/dataset2

makefs has a few constraints that prevent this:

- there must be a dataset with a mountpoint matching the rootpath
- all mountpoints must descend from the root path
- root path must not be canmount=off

My assertion: makefs -t zfs should, as much as possible, be able to create zpool configurations equivalent to those produced by a series of zpool/zfs commands.

1. What are your thoughts on that as a worthwhile direction for makefs?
2. What obstacles do you see in terms of getting there?

I am interested in implementing these changes, and invite all ideas and feedback before proceeding.

Thanks,
Pat