You are not logged in.

#1 2018-10-19 10:17:59

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

ZFS import failing on boot with drives attached to HBA

Hi all,

I have been running Arch Linux with ZFS on Linux for a couple of years now, with all of my drives attached to the motherboard SATA ports.  I decided to experiment a little with an HBA so I bought this ...

01:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
	Subsystem: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]
	Flags: bus master, fast devsel, latency 0, IRQ 58, NUMA node 0
	I/O ports at e000 [size=256]
	Memory at da6c0000 (64-bit, non-prefetchable) [size=16K]
	Memory at da280000 (64-bit, non-prefetchable) [size=256K]
	Expansion ROM at da200000 [disabled] [size=512K]
	Capabilities: [50] Power Management version 3
	Capabilities: [68] Express Endpoint, MSI 00
	Capabilities: [d0] Vital Product Data
	Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [c0] MSI-X: Enable+ Count=15 Masked-
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [138] Power Budgeting <?>
	Capabilities: [150] Single Root I/O Virtualization (SR-IOV)
	Capabilities: [190] Alternative Routing-ID Interpretation (ARI)
	Kernel driver in use: mpt3sas
	Kernel modules: mpt3sas

That is an 8x port SATA PCI-E SAS2008 HBA expansion LSI SAS 9201-8i (9211-8i) IT mode.

When I attach my drives to this HBA and reboot then the zfs-import-cache.service fails.  I discovered that the issue, I think, is with the zfs-import-cache service starting before all the drives have been scanned and detected via the HBA.  I have fixed this issue by editing the zfs-import-cache.service and adding the line ExecStartPre=/usr/bin/sleep 10 before the ExecStart=/usr/bin/zpool import -c /etc/zfs/zpool.cache -aN line.  So this just give the HBA and drives a little extra time to get recognized before zfs tried to import the pool.  Here's the full modified zfs-import-cache.service unti file ...

[Unit]
Description=Import ZFS pools by cache file
DefaultDependencies=no
Requires=systemd-udev-settle.service
After=systemd-udev-settle.service
After=cryptsetup.target
After=systemd-remount-fs.service
Before=dracut-mount.service
Before=zfs-import.target
ConditionPathExists=/etc/zfs/zpool.cache

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=-/sbin/modprobe zfs
ExecStartPre=/usr/bin/sleep 10
ExecStart=/usr/bin/zpool import -c /etc/zfs/zpool.cache -aN

[Install]
WantedBy=zfs-import.target

I don't like having to edit the service unit for a start and I don't like having a fixed time delay in the service.  Is there a better way?  Some way of specifying a dependency for the zfs-import-cache service to make it wait until all drives are present and correct?

Last edited by jjb2016 (2018-10-19 14:01:24)

Offline

Board footer

Powered by FluxBB