ZFS doesn't automount on boot

I've installed the packages zfs-utils and linux419-zfs, enabled the services zfs-import-cache.service, zfs-mount.service and zfs-import.target and executed sudo zpool set cachefile=/etc/zfs/zpool.cache General, but my ZFS drive doesn't get automatically mounted on boot. I don't see any errors in the bootup screen, however when I check the status of the services

● zfs-import-cache.service - Import ZFS pools by cache file
   Loaded: loaded (/usr/lib/systemd/system/zfs-import-cache.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:zpool(8)
● zfs-mount.service - Mount ZFS filesystems
   Loaded: loaded (/usr/lib/systemd/system/zfs-mount.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:zfs(8)
● zfs-import.target - ZFS pool import target
   Loaded: loaded (/usr/lib/systemd/system/zfs-import.target; enabled; vendor preset: enabled)
   Active: inactive (dead)

it shows all of them as dead.
My /etc/default/zfs says this

# ZoL userland configuration.

# To enable a boolean setting, set it to yes, on, true, or 1.
# Anything else will be interpreted as unset.

# Run `zfs mount -a` during system start?
ZFS_MOUNT='yes'

# Run `zfs unmount -a` during system stop?
ZFS_UNMOUNT='yes'

# Run `zfs share -a` during system start?
# nb: The shareiscsi, sharenfs, and sharesmb dataset properties.
ZFS_SHARE='yes'

# Run `zfs unshare -a` during system stop?
ZFS_UNSHARE='yes'

# By default, a verbatim import of all pools is performed at boot based on the
# contents of the default zpool cache file.  The contents of the cache are
# managed automatically by the 'zpool import' and 'zpool export' commands.
#
# By setting this to 'yes', the system will instead search all devices for
# pools and attempt to import them all at boot, even those that have been
# exported.  Under this mode, the search path can be controlled by the
# ZPOOL_IMPORT_PATH variable and a list of pools that should not be imported
# can be listed in the ZFS_POOL_EXCEPTIONS variable.
#
# Note that importing all visible pools may include pools that you don't
# expect, such as those on removable devices and SANs, and those pools may
# proceed to mount themselves in places you do not want them to.  The results
# can be unpredictable and possibly dangerous.  Only enable this option if you
# understand this risk and have complete physical control over your system and
# SAN to prevent the insertion of malicious pools.
ZPOOL_IMPORT_ALL_VISIBLE='no'

# Specify specific path(s) to look for device nodes and/or links for the
# pool import(s). See zpool(8) for more information about this variable.
# It supersedes the old USE_DISK_BY_ID which indicated that it would only
# try '/dev/disk/by-id'.
# The old variable will still work in the code, but is deprecated.
#ZPOOL_IMPORT_PATH="/dev/disk/by-vdev:/dev/disk/by-id"

# List of pools that should NOT be imported at boot
# when ZPOOL_IMPORT_ALL_VISIBLE is 'yes'.
# This is a space separated list.
#ZFS_POOL_EXCEPTIONS="test2"

# List of pools that SHOULD be imported at boot by the initramfs
# instead of trying to import all available pools.  If this is set
# then ZFS_POOL_EXCEPTIONS is ignored.
# Only applicable for Debian GNU/Linux {dkms,initramfs}.
# This is a semi-colon separated list.
#ZFS_POOL_IMPORT="pool1;pool2"

# Should the datasets be mounted verbosely?
# A mount counter will be used when mounting if set to 'yes'.
VERBOSE_MOUNT='no'

# Should we allow overlay mounts?
# This is standard in Linux, but not ZFS which comes from Solaris where this
# is not allowed).
DO_OVERLAY_MOUNTS='no'

# Any additional option to the 'zfs import' commandline?
# Include '-o' for each option wanted.
# You don't need to put '-f' in here, unless you want it ALL the time.
# Using the option 'zfsforce=1' on the grub/kernel command line will
# do the same, but on a case-to-case basis.
ZPOOL_IMPORT_OPTS=""

# Full path to the ZFS cache file?
# See "cachefile" in zpool(8).
# The default is "/etc/zfs/zpool.cache".
#ZPOOL_CACHE="/etc/zfs/zpool.cache"
#
# Setting ZPOOL_CACHE to an empty string ('') AND setting ZPOOL_IMPORT_OPTS to
# "-c /etc/zfs/zpool.cache" will _enforce_ the use of a cache file.
# This is needed in some cases (extreme amounts of VDEVs, multipath etc).
# Generally, the use of a cache file is usually not recommended on Linux
# because it sometimes is more trouble than it's worth (laptops with external
# devices or when/if device nodes changes names).
#ZPOOL_IMPORT_OPTS="-c /etc/zfs/zpool.cache"
#ZPOOL_CACHE=""

# Any additional option to the 'zfs mount' command line?
# Include '-o' for each option wanted.
MOUNT_EXTRA_OPTIONS=""

# Build kernel modules with the --enable-debug switch?
# Only applicable for Debian GNU/Linux {dkms,initramfs}.
ZFS_DKMS_ENABLE_DEBUG='no'

# Keep debugging symbols in kernel modules?
# Only applicable for Debian GNU/Linux {dkms,initramfs}.
ZFS_DKMS_DISABLE_STRIP='no'

# Wait for this many seconds in the initrd pre_mountroot?
# This delays startup and should be '0' on most systems.
# Only applicable for Debian GNU/Linux {dkms,initramfs}.
ZFS_INITRD_PRE_MOUNTROOT_SLEEP='0'

# Wait for this many seconds in the initrd mountroot?
# This delays startup and should be '0' on most systems. This might help on
# systems which have their ZFS root on a USB disk that takes just a little
# longer to be available
# Only applicable for Debian GNU/Linux {dkms,initramfs}.
ZFS_INITRD_POST_MODPROBE_SLEEP='0'

# List of additional datasets to mount after the root dataset is mounted?
#
# The init script will use the mountpoint specified in the 'mountpoint'
# property value in the dataset to determine where it should be mounted.
#
# This is a space separated list, and will be mounted in the order specified,
# so if one filesystem depends on a previous mountpoint, make sure to put
# them in the right order.
#
# It is not necessary to add filesystems below the root fs here. It is
# taken care of by the initrd script automatically. These are only for
# additional filesystems needed. Such as /opt, /usr/local which is not
# located under the root fs.
# Example: If root FS is 'rpool/ROOT/rootfs', this would make sense.
#ZFS_INITRD_ADDITIONAL_DATASETS="rpool/ROOT/usr rpool/ROOT/var"

# Optional arguments for the ZFS Event Daemon (ZED).
# See zed(8) for more information on available options.
#ZED_ARGS="-M"

Why doesn't my drive get automounted on boot? Am I missing something?
Here's my inxi

System:    Host: Kiko-LTL Kernel: 4.19.66-1-MANJARO x86_64 bits: 64 compiler: gcc v: 9.1.0 Console: N/A wm: kwin_x11 dm: SDDM 
           Distro: Manjaro Linux 
Machine:   Type: Laptop System: Acer product: Aspire A515-51G v: V1.08 serial: <filter> 
           Mobo: KBL model: Charmander_KL v: V1.08 serial: <filter> UEFI: Insyde v: 1.08 date: 06/15/2017 
Battery:   ID-1: BAT1 charge: 28.0 Wh condition: 39.9/48.9 Wh (82%) volts: 15.5/15.2 model: COMPAL PABAS0241231 type: Li-ion 
           serial: <filter> status: Discharging 
CPU:       Topology: Quad Core model: Intel Core i5-8250U bits: 64 type: MT MCP arch: Kaby Lake rev: A L1 cache: 256 KiB 
           L2 cache: 6144 KiB L3 cache: 6144 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 28808 
           Speed: 800 MHz min/max: 400/1600 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 797 
Graphics:  Device-1: Intel UHD Graphics 620 vendor: Acer Incorporated ALI driver: i915 v: kernel bus ID: 00:02.0 
           chip ID: 8086:5917 
           Device-2: NVIDIA GP108M [GeForce MX150] driver: N/A bus ID: 01:00.0 chip ID: 10de:1d10 
           Display: server: X.Org 1.20.5 driver: modesetting compositor: kwin_x11 resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa DRI Intel UHD Graphics 620 (Kabylake GT2) v: 4.5 Mesa 19.1.4 compat-v: 3.0 
           direct render: Yes 
Audio:     Device-1: Intel Sunrise Point-LP HD Audio vendor: Acer Incorporated ALI driver: snd_hda_intel v: kernel 
           bus ID: 00:1f.3 chip ID: 8086:9d71 
           Device-2: Logitech [G533 Wireless Headset Dongle] type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-2:2 
           chip ID: 046d:0a66 
           Sound Server: ALSA v: k4.19.66-1-MANJARO 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Acer Incorporated ALI driver: r8168 
           v: 8.047.02-NAPI port: 3000 bus ID: 02:00.1 chip ID: 10ec:8168 
           IF: enp2s0f1 state: down mac: <filter> 
           Device-2: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi v: kernel port: 3000 bus ID: 03:00.0 
           chip ID: 8086:24fb 
           IF: wlp3s0 state: up mac: <filter> 
           IF-ID-1: tun0 state: unknown speed: 10 Mbps duplex: full mac: N/A 
Drives:    Local Storage: total: 1.03 TiB used: 69.65 GiB (6.6%) 
           ID-1: /dev/sda vendor: Toshiba model: MQ04ABF100 size: 931.51 GiB speed: 6.0 Gb/s rotation: 5400 rpm 
           serial: <filter> rev: 1J scheme: GPT 
           ID-2: /dev/sdb vendor: A-Data model: SU800NS38 size: 119.24 GiB speed: 6.0 Gb/s serial: <filter> rev: 8BS 
           scheme: GPT 
RAID:      Device-1: General type: zfs status: ONLINE raid: no-raid size: 928.00 GiB free: 928.00 GiB allocated: 1.1 MiB 
           Components: online: N/A 
Partition: ID-1: / size: 42.80 GiB used: 22.40 GiB (52.3%) fs: ext4 dev: /dev/sdb7 
           ID-2: swap-1 size: 2.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sdb6 
Sensors:   System Temperatures: cpu: 32.0 C mobo: 29.8 C 
           Fan Speeds (RPM): N/A 
Info:      Processes: 393 Uptime: 1h 33m Memory: 7.67 GiB used: 1.30 GiB (16.9%) Init: systemd v: 242 Compilers: gcc: 9.1.0 
           Shell: bash (sudo) v: 5.0.7 running in: konsole inxi: 3.0.35 

Did you enable zfs.target?

3 Likes

Yes, it says it right there in the post.

I must be missing it. I see zfs-import.target, did you also enable zfs.target?

Oh **** you're right, that is what I was missing! There were 2 different target services :frowning_face::palm_tree:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by