mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add canonical mount options zfs-mount-generator
lib/libzfs/libzfs_mount.c:zfs_add_options provides the canonical mount options used by a `zfs mount` command. Because we cannot call `zfs mount` directly from a systemd.mount unit, we mirror that logic in zfs-mount-generator. The zed script is updated to cache these properties as well. Include a mini-tutorial in the manual page, properly substitute configuration paths in zfs-mount-generator.8.in, and standardize the Makefile. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Laager <rlaager@wiktel.com> Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com> Closes #7453
This commit is contained in:
committed by
Brian Behlendorf
parent
29badadd4e
commit
68fded8146
+9
-16
@@ -4,7 +4,6 @@ dist_man_MANS = \
|
||||
vdev_id.8 \
|
||||
zdb.8 \
|
||||
zfs.8 \
|
||||
zfs-mount-generator.8 \
|
||||
zfs-program.8 \
|
||||
zgenhostid.8 \
|
||||
zinject.8 \
|
||||
@@ -12,24 +11,18 @@ dist_man_MANS = \
|
||||
zstreamdump.8
|
||||
|
||||
nodist_man_MANS = \
|
||||
zed.8
|
||||
zed.8 \
|
||||
zfs-mount-generator.8
|
||||
|
||||
EXTRA_DIST = \
|
||||
zed.8.in
|
||||
zed.8.in \
|
||||
zfs-mount-generator.8.in
|
||||
|
||||
zed.8: $(srcdir)/zed.8.in
|
||||
|
||||
do_subst = $(SED) \
|
||||
-e 's|@libexecdir[@]|$(libexecdir)|g' \
|
||||
-e 's|@runstatedir[@]|$(runstatedir)|g' \
|
||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g'
|
||||
|
||||
$(nodist_man_MANS): Makefile
|
||||
$(RM) $@ $@.tmp
|
||||
srcdir=''; \
|
||||
test -f ./$@.in || srcdir=$(srcdir)/; \
|
||||
$(do_subst) $${srcdir}$@.in >$@.tmp
|
||||
mv $@.tmp $@
|
||||
$(nodist_man_MANS): %: %.in
|
||||
-$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
|
||||
-e 's,@runstatedir\@,$(runstatedir),g' \
|
||||
-e 's,@sysconfdir\@,$(sysconfdir),g' \
|
||||
$< >'$@'
|
||||
|
||||
install-data-local:
|
||||
$(INSTALL) -d -m 0755 "$(DESTDIR)$(mandir)/man8"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
.TH "ZFS\-MOUNT\-GENERATOR" "8" "ZFS" "zfs-mount-generator" "\""
|
||||
.SH "NAME"
|
||||
zfs\-mount\-generator \- generates systemd mount units for zfs
|
||||
zfs\-mount\-generator \- generates systemd mount units for ZFS
|
||||
.SH SYNOPSIS
|
||||
.B /lib/systemd/system-generators/zfs\-mount\-generator
|
||||
.sp
|
||||
.SH DESCRIPTION
|
||||
The zfs\-mount\-generator implements the \fBGenerators Specification\fP
|
||||
zfs\-mount\-generator implements the \fBGenerators Specification\fP
|
||||
of
|
||||
.BR systemd (1),
|
||||
and is called during early boot to generate
|
||||
@@ -26,7 +26,7 @@ information on ZFS mountpoints must be stored separately. The output
|
||||
of the command
|
||||
.PP
|
||||
.RS 4
|
||||
zfs list -H -oname,mountpoint,canmount
|
||||
zfs list -H -o name,mountpoint,canmount,atime,relatime,devices,exec,readonly,setuid,nbmand
|
||||
.RE
|
||||
.PP
|
||||
for datasets that should be mounted by systemd, should be kept
|
||||
@@ -45,6 +45,33 @@ history_event-zfs-list-cacher.sh .
|
||||
.RE
|
||||
.PP
|
||||
.sp
|
||||
.SH EXAMPLE
|
||||
To begin, enable tracking for the pool:
|
||||
.PP
|
||||
.RS 4
|
||||
touch
|
||||
.RI @sysconfdir@/zfs/zfs-list.cache/ POOLNAME
|
||||
.RE
|
||||
.PP
|
||||
Then, enable the tracking ZEDLET:
|
||||
.PP
|
||||
.RS 4
|
||||
ln -s "@libexecdir@/zfs/zed.d/history_event-zfs-list-cacher.sh" "@sysconfdir@/zfs/zed.d/"
|
||||
|
||||
systemctl enable zed.service
|
||||
|
||||
systemctl restart zed.service
|
||||
.RE
|
||||
.PP
|
||||
Force the running of the ZEDLET by setting canmount=on for at least one dataset in the pool:
|
||||
.PP
|
||||
.RS 4
|
||||
zfs set canmount=on
|
||||
.I DATASET
|
||||
.RE
|
||||
.PP
|
||||
This forces an update to the stale cache file.
|
||||
.sp
|
||||
.SH SEE ALSO
|
||||
.BR zfs (5)
|
||||
.BR zfs-events (5)
|
||||
Reference in New Issue
Block a user