Generating a zpool.cache on FreeBSD's ZFS

If this helps one person, my work here is done. If you can’t work out how to generate a new /boot/zfs/zpool.cache (until the work in 9-STABLE means you don’t have to. Try this.

Boot from your FreeBSD-9.0-RELEASE-i386-memstick.img on USB or whatever. Go to shell and try this command:

zpool import -d /dev/gpt/ -R /mnt -o cachefile=/tmp/zpool.cache

This will scan all of the disks in /dev/gpt (I built mine with gpart, if you didn’t, just try /dev/) for ZFS zpool labelling information, and then it kindly spits out the cachefil to /tmp/zpool.cache, which you can cp to your /mnt/boot/zfs/zpool.cache!

All this is typed from memory, as, umm, I can’t cut and paste from a USB stick, but the -d/-o trick is what finally worked for me.