zpool import is indeed the one and only command to import ZFS pools, both those that were properly zpool exported before and those that were not.
You should first check with zpool list if the pool hasn’t already be imported. If that is not the case, zpool import will list all pools available for import. If the pool was not exported first, you may need the -f flag. You can look at specific devices using zpool import -d.
Combined, it could look like this:
# zpool import -d /home/daniel/zpool-test-1.img
pool: test123
id: 12638011090530745002
state: DEGRADED
status: One or more devices are missing from the system.
action: The pool can be imported despite missing or damaged devices. The
fault tolerance of the pool may be compromised if imported.
see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-2Q
config:
test123 DEGRADED
mirror-0 DEGRADED
/home/daniel/zpool-test-1.img ONLINE
/home/daniel/zpool-test-b.img UNAVAIL cannot open
(I forced this problem by renaming the files.)
You would then simply import the pool:
zpool import -d /home/daniel/zpool-test-1.img test123
I recommend you do not use zpool import -a, just to make sure you only deal with the ZFS pool you want to.
You can then use zfs list to find out where stuff is mounted. ZFS takes care of that automatically (unless specifically told not to).
You can inspect pool devices without importing them using zdb:
# zdb -l zpool-test-1.img
------------------------------------
LABEL 0
------------------------------------
version: 5000
name: 'test123'
state: 1
txg: 19
pool_guid: 12638011090530745002
errata: 0
hostname: 'server'
top_guid: 6892256335198247059
guid: 11629412553399697108
vdev_children: 1
vdev_tree:
type: 'mirror'
id: 0
guid: 6892256335198247059
metaslab_array: 64
metaslab_shift: 29
ashift: 9
asize: 5363990528
is_log: 0
create_txg: 4
children[0]:
type: 'file'
id: 0
guid: 11629412553399697108
path: '/home/daniel/zpool-test-a.img'
create_txg: 4
children[1]:
type: 'file'
id: 1
guid: 1859957653576985949
path: '/home/daniel/zpool-test-b.img'
create_txg: 4
features_for_read:
com.delphix:hole_birth
com.delphix:embedded_data
com.klarasystems:vdev_zaps_v2
labels = 0 1 2 3
Just try all the partitions until you find the right one(s).
You should be able to identify the devices/partitions containing ZFS with fdisk -l unless you chose “incorrect” (non-descriptive) partition type IDs. For “full-disk” vdevs, ZFS creates two GPT partitions nowadays, one of type “Solaris /usr & Apple ZFS” and one of type “Solaris reserved 1”.
But ideally, just connect all the drives and let ZFS figure it out, it really should find the pool automatically on regular block devices, USB or not.