Closed
Description
System information
Type | Version/Name |
---|---|
Distribution Name | Fedora |
Distribution Version | 33 |
Linux Kernel | 5.9.16-200.fc33.x86_64 |
Architecture | x86_64 |
ZFS Version | 2.0.1-1 |
SPL Version | 2.0.1-1 |
util-linux Version | 2.36-3.fc33.x86_64 |
Describe the problem you're observing
With systemd .mount
units, the mount
command gets run in CWD /
, which causes mount
to turn the source argument into an absolute path before calling mount.zfs
. This is problematic with the default mountpoint scheme where the dataset name is the mountpoint. When mount
is called with pool/dataset
as the source, mount.zfs
gets called with /pool/dataset
.
This can be worked around when mounting manually by:
- Passing
--no-canonicalize
tomount
- Running mount from anywhere else besides
/
Unfortunately, I don't think systemd .mount
units support either of those options. Would it be feasible to try and detect this somehow in mount.zfs
or maybe there's a better workaround available?
Describe how to reproduce the problem
- Enable systemd-mount-generator:
touch /etc/zfs/zfs-list.cache/pool
- Create a test dataset and unmount it:
zfs create pool/test
zfs unmount pool/test
- Reload systemd and try to mount the volume:
systemctl daemon-reload
systemctl start pool-test.mount
- The mount fails with:
filesystem '/pool/test' cannot be mounted, unable to open the dataset
The mount
canonicalization behavior can also be reproduced by:
$ zfs create pool/test
$ zfs unmount pool/test
$ cd /
$ mount pool/test /pool/test -t zfs -o defaults,atime,relatime,dev,exec,rw,suid,nomand,zfsutil
filesystem '/pool/test' cannot be mounted, unable to open the dataset
$ cd /tmp
$ mount pool/test /pool/test -t zfs -o defaults,atime,relatime,dev,exec,rw,suid,nomand,zfsutil
# ^^ Works outside of /
$ umount /pool/test
$ mount pool/test /pool/test -t zfs -o defaults,atime,relatime,dev,exec,rw,suid,nomand,zfsutil --no-canonicalize
# ^^ Also works with --no-canonicalize