]> git.proxmox.com Git - mirror_zfs.git/blob - man/man8/zfs-mount-generator.8.in
etc/init.d: decide which variant to use at build time.
[mirror_zfs.git] / man / man8 / zfs-mount-generator.8.in
1 .TH "ZFS\-MOUNT\-GENERATOR" "8" "ZFS" "zfs-mount-generator" "\""
2 .SH "NAME"
3 zfs\-mount\-generator \- generates systemd mount units for ZFS
4 .SH SYNOPSIS
5 .B /lib/systemd/system-generators/zfs\-mount\-generator
6 .sp
7 .SH DESCRIPTION
8 zfs\-mount\-generator implements the \fBGenerators Specification\fP
9 of
10 .BR systemd (1),
11 and is called during early boot to generate
12 .BR systemd.mount (5)
13 units for automatically mounted datasets. Mount ordering and dependencies
14 are created for all tracked pools (see below). If a dataset has
15 .BR canmount=on
16 and
17 .BR mountpoint
18 set, the
19 .BR auto
20 mount option will be set, and a dependency for
21 .BR local-fs.target
22 on the mount will be created.
23
24 Because zfs pools may not be available very early in the boot process,
25 information on ZFS mountpoints must be stored separately. The output
26 of the command
27 .PP
28 .RS 4
29 zfs list -H -o name,mountpoint,canmount,atime,relatime,devices,exec,readonly,setuid,nbmand
30 .RE
31 .PP
32 for datasets that should be mounted by systemd, should be kept
33 separate from the pool, at
34 .PP
35 .RS 4
36 .RI @sysconfdir@/zfs/zfs-list.cache/ POOLNAME
37 .
38 .RE
39 .PP
40 The cache file, if writeable, will be kept synchronized with the pool
41 state by the ZEDLET
42 .PP
43 .RS 4
44 history_event-zfs-list-cacher.sh .
45 .RE
46 .PP
47 .sp
48 .SH EXAMPLE
49 To begin, enable tracking for the pool:
50 .PP
51 .RS 4
52 touch
53 .RI @sysconfdir@/zfs/zfs-list.cache/ POOLNAME
54 .RE
55 .PP
56 Then, enable the tracking ZEDLET:
57 .PP
58 .RS 4
59 ln -s "@zfsexecdir@/zed.d/history_event-zfs-list-cacher.sh" "@sysconfdir@/zfs/zed.d"
60
61 systemctl enable zed.service
62
63 systemctl restart zed.service
64 .RE
65 .PP
66 Force the running of the ZEDLET by setting canmount=on for at least one dataset in the pool:
67 .PP
68 .RS 4
69 zfs set canmount=on
70 .I DATASET
71 .RE
72 .PP
73 This forces an update to the stale cache file.
74 .sp
75 .SH SEE ALSO
76 .BR zfs (5)
77 .BR zfs-events (5)
78 .BR zed (8)
79 .BR zpool (5)
80 .BR systemd (1)
81 .BR systemd.target (5)
82 .BR systemd.special (7)
83 .BR systemd.mount (7)