diff --git a/etc/modules-load.d/zfs.conf.in b/etc/modules-load.d/zfs.conf.in index 73304bc2cd4a..8b41baa300cb 100644 --- a/etc/modules-load.d/zfs.conf.in +++ b/etc/modules-load.d/zfs.conf.in @@ -1 +1,3 @@ -zfs +# Always load kernel modules at boot. The default behavior is to load the +# kernel modules in the zfs-import-*.service or when blkid(8) detects a pool. +#zfs diff --git a/etc/systemd/system/50-zfs.preset.in b/etc/systemd/system/50-zfs.preset.in index 4efdd7200655..4d82778e35ba 100644 --- a/etc/systemd/system/50-zfs.preset.in +++ b/etc/systemd/system/50-zfs.preset.in @@ -1,2 +1,7 @@ # ZFS is enabled by default -enable zfs.* +enable zfs-import-cache.service +disable zfs-import-scan.service +enable zfs-mount.service +enable zfs-share.service +enable zfs-zed.service +enable zfs.target diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in index b1deb6ed9630..8a444b13da22 100644 --- a/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in @@ -4,6 +4,7 @@ DefaultDependencies=no Requires=systemd-udev-settle.service After=systemd-udev-settle.service After=cryptsetup.target +After=systemd-remount-fs.service ConditionPathExists=@sysconfdir@/zfs/zpool.cache [Service] @@ -11,3 +12,7 @@ Type=oneshot RemainAfterExit=yes ExecStartPre=/sbin/modprobe zfs ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN + +[Install] +WantedBy=zfs-mount.service +WantedBy=zfs.target diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in index 517e12e3a26e..01052838a948 100644 --- a/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in @@ -10,4 +10,8 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache Type=oneshot RemainAfterExit=yes ExecStartPre=/sbin/modprobe zfs -ExecStart=@sbindir@/zpool import -d /dev/disk/by-id -aN +ExecStart=@sbindir@/zpool import -aN -o cachefile=none + +[Install] +WantedBy=zfs-mount.service +WantedBy=zfs.target diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in index f1056af311cd..0664fd9e7665 100644 --- a/etc/systemd/system/zfs-mount.service.in +++ b/etc/systemd/system/zfs-mount.service.in @@ -1,15 +1,17 @@ [Unit] Description=Mount ZFS filesystems DefaultDependencies=no -Wants=zfs-import-cache.service -Wants=zfs-import-scan.service -Requires=systemd-udev-settle.service After=systemd-udev-settle.service After=zfs-import-cache.service After=zfs-import-scan.service +After=systemd-remount-fs.service Before=local-fs.target [Service] Type=oneshot RemainAfterExit=yes ExecStart=@sbindir@/zfs mount -a + +[Install] +WantedBy=zfs-share.service +WantedBy=zfs.target diff --git a/etc/systemd/system/zfs-share.service.in b/etc/systemd/system/zfs-share.service.in index 1230320e3381..688731ea3e27 100644 --- a/etc/systemd/system/zfs-share.service.in +++ b/etc/systemd/system/zfs-share.service.in @@ -3,12 +3,14 @@ Description=ZFS file system shares After=nfs-server.service nfs-kernel-server.service After=smb.service After=zfs-mount.service -Requires=zfs-mount.service PartOf=nfs-server.service nfs-kernel-server.service PartOf=smb.service [Service] Type=oneshot RemainAfterExit=yes -ExecStartPre=-@bindir@/rm /etc/dfs/sharetab +ExecStartPre=-@bindir@/rm -f /etc/dfs/sharetab ExecStart=@sbindir@/zfs share -a + +[Install] +WantedBy=zfs.target diff --git a/etc/systemd/system/zfs-zed.service.in b/etc/systemd/system/zfs-zed.service.in index 4d4c9d841323..e3dec3dca1b6 100644 --- a/etc/systemd/system/zfs-zed.service.in +++ b/etc/systemd/system/zfs-zed.service.in @@ -10,3 +10,4 @@ Restart=on-abort [Install] Alias=zed.service +WantedBy=zfs.target diff --git a/etc/systemd/system/zfs.target.in b/etc/systemd/system/zfs.target.in index ce110e573bac..4699463b0ddf 100644 --- a/etc/systemd/system/zfs.target.in +++ b/etc/systemd/system/zfs.target.in @@ -1,8 +1,5 @@ [Unit] Description=ZFS startup target -Requires=zfs-mount.service -Requires=zfs-share.service -Wants=zfs-zed.service [Install] WantedBy=multi-user.target