Linux – ZFS pool disappears after reboot on Debian 8

debianlinuxsysvinitzfs

I'm getting started with ZFS and I got the basics down, but I'm having an issue with keeping it running.

Pools are created, mounts are created, I'm able to save data and see disk activity… things are looking good. However, after rebooting zpool list reports "no pools available".

I have found several articles about this on CentOS which talk about a startup script for zfs being the fix, but thus far I haven't found one on Debian.

I'm using the Debian backport zfs-dkms package, which dependency includes libzfs2linux, libzpool2linux, bfs-zed, and zfsutils-linux. I am also running in SysV init mode instead of systemd.

I've tried recreating the pool with /dev/disk/by-id as well as standards /dev/sdx devices; I've tried editing /etc/default/zfs and setting (not all at once):

ZFS_MOUNT='yes'
ZPOOL_IMPORT_ALL_VISIBLE='yes'
ZPOOL_IMPORT_PATH="/dev/disk/by-vdev:/dev/disk/by-id"
ZPOOL_IMPORT_PATH="/dev"
ZFS_INITRD_POST_MODPROBE_SLEEP='5'

I see my pool configuration names in /etc/zfs/zpool.cache; I can re-import everything fine manually with zpool import <pool-name> and all the data is there.

Is this a timing issue on boot? I'm running short on possible ideas and any input would be appreciated.

Best Answer

I came across a mailing list posting yesterday evening that resolves the mystery here. It indicates zfs_autoimport_disable is now compiled as set to 1/true by default! So it doesn't matter what is configured in /etc/default/zfs, the pools will never import when the zfs module loads.

So the fix for me was to add an /etc/modprobe.d/ config file (call it what you like) and define options zfs zfs_autoimport_disable=0. Now the pools are imported and the zfs file systems can be mounted either by zfs or in legacy mode.

I don't understand this decision, but now everything is working as expected...

Related Question