Solved ZFS not importing all pools at startup

Hi Peoples!

I have an odd scenario with a zpool. On a node reboot I am having to re-import the second and subsequent pools manually using zpool import xyz_pool. The pool imports without issue and is OK once manually imported. The zroot pool always mounts OK.

As background
  • The boot partition is not on ZFS but on a UFS partition (on a USB stick), which has the standard kernel files within /boot for the kernel to post.
  • The zfs pool zroot is mounted at / where the rest of the system is found.
  • An entry in /etc/fstab which mounts the USB root at /usb and a soft symlink between /boot and /usb/boot has been created.

The output of zdb -CU /usb/boot/zfs/zpool.cache is showing xyz_pool as expected. On reboot /usb/boot/zfs/zpool.cache does not contain xyz_pool.

Any ideas and help very much welcomed please!
 
Fixed it. What follows is my ramblings which resulted in getting it to work. Others milege using this approach may vary.

As the ufs usb boot drive contained the correct content on load (checked in single user mode on another machine), it occurred to me that /boot/zfs/zpool.cache hosted on the zpool did not exist (there was no /boot directory on the zroot pool just a symlink).
When the zroot pool mounted it did not have a valid /boot directory (broken symlink at that point in the boot as USB had not been mounted under /usb yet) and thus only imported the zroot ZFS pool.

The actions to resolve were:
  • Dropped the /boot SymLink (/boot -> /usb/boot)
  • Added nullfs_load="YES" to /boot/loader.conf on the USB device
  • Added /usb/boot /boot nullfs rw 0 0 to /etc/fstab on the USB device
  • Made directory /boot/zfs on the zroot pool
  • Copied /usb/boot/zfs/zpool.cache to /boot/zfs/ on the zroot pool
And rebooted - all OK.

When adding new pools, I need to remember to update the version of the zpool.cache in the zroot pool from the USB device:
  • umount /boot
  • cp /usb/boot/zfs/zpool.cache /boot/zfs/
  • mount -a
 
Back
Top