After configuring ZFS (version 0.6.5) on CentOS 7 and creating a zpool, the system fails to maintain datasets across reboots. The zfs list
command returns "no datasets available" and zpool list
shows "no pools available" post-reboot.
The zfs-import-cache
service appears inactive, despite being loaded:
zfs-import-cache.service - Import ZFS pools by cache file
Loaded: loaded (/usr/lib/systemd/system/zfs-import-cache.service; static)
Active: inactive (dead)
While manual import works using:
zpool import -c /etc/zfs/zpool.cache
And setting the cache file path helps temporarily:
zpool set cachefile=/etc/zfs/zpool.cache PoolName
This solution isn't persistent and requires manual intervention after each reboot.
The /etc/sysconfig/zfs
configuration shows standard settings, but key parameters might need adjustment:
# Run zfs mount during system start?
ZFS_MOUNT='yes'
# Run zfs unmount during system stop?
ZFS_UNMOUNT='yes'
Option 1: Enable Cache Service Persistently
First, verify the cache file exists and contains your pool:
ls -l /etc/zfs/zpool.cache
hexdump -C /etc/zfs/zpool.cache
Then enable and start the service:
systemctl enable zfs-import-cache
systemctl start zfs-import-cache
Option 2: Alternative Import Method
Configure the system to import by device ID instead of cache file:
systemctl disable zfs-import-cache
systemctl enable zfs-import.target
systemctl enable zfs-import-scan.service
After implementing changes, verify with:
systemctl status zfs-import*
zpool status
zfs list
Check the boot sequence logs for ZFS-related errors:
journalctl -b | grep -i zfs
dmesg | grep -i zfs
For more detailed debugging, increase ZFS verbosity:
echo 1 > /sys/module/zfs/parameters/zfs_dbgmsg_enable
zpool events
Create custom systemd units for critical datasets:
[Unit]
Description=Mount ZFS dataset
After=zfs-import.target
[Service]
Type=oneshot
ExecStart=/usr/bin/zfs mount pool/dataset
TimeoutSec=0
[Install]
WantedBy=multi-user.target
After configuring ZFS 0.6.5 on CentOS 7, I encountered a persistent issue where all datasets and pools become unavailable after system reboot. Running zfs list
returns "no datasets available" and zpool list
shows "no pools available".
The temporary solution involves manual cache file operations:
# Before reboot
zpool set cachefile=/etc/zfs/zpool.cache PoolName
# After reboot
zpool import -c /etc/zfs/zpool.cache
The zfs-import-cache
service shows inactive status:
systemctl status zfs-import-cache
● zfs-import-cache.service - Import ZFS pools by cache file
Loaded: loaded (/usr/lib/systemd/system/zfs-import-cache.service; static)
Active: inactive (dead)
The /etc/sysconfig/zfs
configuration appears standard, but these key parameters might need adjustment:
ZFS_MOUNT='yes'
ZFS_UNMOUNT='yes'
ZFS_SHARE='yes'
ZFS_UNSHARE='yes'
After thorough testing, this combination of steps resolved the issue permanently:
# 1. Create cache directory if missing
sudo mkdir -p /etc/zfs
# 2. Set cache file location
sudo zpool set cachefile=/etc/zfs/zpool.cache PoolName
# 3. Enable systemd services
sudo systemctl enable zfs-import-cache
sudo systemctl enable zfs-import.target
sudo systemctl enable zfs-mount
sudo systemctl enable zfs-share
# 4. Verify boot parameters
sudo cat /etc/default/grub | grep zfs
For environments where cache files aren't desirable, configure device scanning:
# Edit /etc/default/zfs
ZPOOL_IMPORT_PATH="/dev/disk/by-id /dev/disk/by-partuuid"
# Then regenerate initramfs
sudo dracut -f
- Check boot logs:
journalctl -b | grep zfs
- Verify module loading:
lsmod | grep zfs
- Test manual import:
zpool import -a
- Inspect cache file:
file /etc/zfs/zpool.cache