Skip to content

Instantly share code, notes, and snippets.

@wrouesnel
Last active July 11, 2023 19:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wrouesnel/62fae4421a4faa4b4e86 to your computer and use it in GitHub Desktop.
Save wrouesnel/62fae4421a4faa4b4e86 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