ZFS Importing /dev/disk/by-id…

I had the dubious pleasure of having to (re-)import a ZFS pool by disk ID… i.e. zpool import -d /dev/disk/by-id <POOL NAME>, unfortunately, on my system, everything appeared as WWNs, like “wwn-0x5111c500c8708981-part1” – instead of my expected “ata-<MODEL>-<BUILD>_<HDD SERIAL>-part1” where I could easily determine which disk a specific zpool/zvol was on.

So the fix, given I know I had all my SATA drives’ “part1” as part of my zpool, and that my log was on my NVMe drive, the following commands imported the individual vdevs according to my desired tags/handles:

devices=()

for dev in /dev/disk/by-id/ata-*-part1; do
    devices+=(-d "$dev")
done

# Include the NVMe SLOG explicitly
devices+=(-d /dev/disk/by-id/nvme-<MODEL>_<BUILD>_<SERIAL>-part5)

Doing a last check:

  • printf '%s\n' "${devices[@]}"

Then check the import:

  • zpool import "${devices[@]}"

And finally, assuming all is good, import!

  • zpool import "${devices[@]}" <POOL NAME>

Lastly, verify the vdev paths:

  • zpool status -P <POOL NAME>

Leave a Reply