Skip to content

Instantly share code, notes, and snippets.

@MynaITLabs
Forked from wrouesnel/zed.service
Created August 7, 2024 18:46
Show Gist options
  • Save MynaITLabs/43c1f10c8e1dd27c003abf6325932b42 to your computer and use it in GitHub Desktop.
Save MynaITLabs/43c1f10c8e1dd27c003abf6325932b42 to your computer and use it in GitHub Desktop.
systemd unit files for ZFS
[Unit]
Description=ZFS Event Daemon (zed)
Documentation=man:zed(8)
After=zfs-import-cache.service
After=zfs-import-scan.service
[Service]
Type=forking
ExecStart=/sbin/zed
PIDFile=/run/zed.pid
User=root
Group=root
Restart=on-abort
[Unit]
Description=Import ZFS pools by cache file
DefaultDependencies=no
Requires=systemd-udev-settle.service
After=systemd-udev-settle.service
ConditionPathExists=/etc/zfs/zpool.cache
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/zpool import -c /etc/zfs/zpool.cache -aN
[Unit]
Description=Import ZFS pools by device scanning
DefaultDependencies=no
Requires=systemd-udev-settle.service
After=systemd-udev-settle.service
ConditionPathExists=!/zfs/zpool.cache
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/zpool import -d /dev/disk/by-id -aN
[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
Before=local-fs.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/zfs mount -a
[Unit]
Description=ZFS file system shares
After=nfs-server.service
After=smb.service
PartOf=nfs-server.service
PartOf=smb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/zfs share -a
[Unit]
Description=ZFS startup target
Requires=zfs-mount.service
Requires=zfs-share.service
Wants=zed.service
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment