Some of my ZFS pools referred to sda, sdb, sdc, sdd, sde etc which can change at boot especially if SATA ports are swapped.
I’ve struggled to find a definitive answer for whether ZFS is storing more permanent GUIDs or UUIDs under the hood, but to be on the safe side, I’ve looked into ways to convert from the sdX to a unique ID instead.
What worked for me on Ubuntu 24.04 was the following:
zpool export tank
sleep 5
zpool import -d /dev/disk/by-id -aN
This was a combination of multiple instructions on the web, especially https://forum.level1techs.com/t/switching-zfs-pool-to-partuuid-from-dev-sda-labeling-for-server-migration/202731/4
My disks are now loaded via their WWN (worldwide number) .
This can be a bit cryptic, so another option is to use the ATA number which includes the model & serial number of the drive – these are nice because they help identify the physical disk, i.e.
zpool export tank
sleep 5
zpool import -d /dev/disk/by-id/ata-WDC_WDxxxxxxxxxxxxxx -aN
Where xxxxxxxxx is the rest of the HDD model & serial number. Be sure to check whether your pool points to a full block device or a partition. If it’s a partition e.g. sdb1 then expect to need to import /dev/disk/by-id/ata-WDC_WDxxxxxxxxxxxxx-part1
What if your zfs filesystems don’t mount after this?
I found that my pool was then imported correctly under zfs list, but the filesystem didn’t mount.
Issuing a zpool export <pool> followed by zpool import <poolname> resolved this.