我有一个 Arch Linux ZFS 备份系统,它很长时间没有更新了,因为它运行良好,没有必要费心。不过,在最近的一次升级之后,我的 ZFS 数据集在重新启动时不再自动挂载。不幸的是,服务没有显示任何错误消息,我可以运行
# zfs mount -a
系统启动无问题后。一些细节:
[root@elephant etc]# uname -a
Linux elephant 4.16.11-1-ARCH #1 SMP PREEMPT Tue May 22 21:40:27 UTC 2018 x86_64 GNU/Linux
[root@elephant etc]# pacman -Q | grep spl
spl-dkms 0.7.9-1
spl-utils 0.7.9-1
[root@elephant etc]# pacman -Q | grep zfs
zfs-dkms 0.7.9-1
zfs-utils 0.7.9-1
root@elephant etc]# zfs get mountpoint backup/www
NAME PROPERTY VALUE SOURCE
backup/www mountpoint /backup/www default
[root@elephant etc]# zfs get mountpoint backup/data
NAME PROPERTY VALUE SOURCE
backup/data mountpoint /backup/data default
[root@elephant etc]# zfs get mountpoint backup/metadata
NAME PROPERTY VALUE SOURCE
backup/metadata mountpoint /backup/metadata default
请特别注意,zfs-mount 服务似乎运行正常:
[root@elephant ~]# systemctl -l status zfs*
● zfs.target - ZFS startup target
Loaded: loaded (/usr/lib/systemd/system/zfs.target; enabled; vendor preset: enabled)
Active: active since Mon 2018-05-28 15:30:18 CDT; 1min 32s ago
May 28 15:30:18 elephant systemd[1]: Reached target ZFS startup target.
● zfs-import-cache.service - Import ZFS pools by cache file
Loaded: loaded (/usr/lib/systemd/system/zfs-import-cache.service; enabled; vendor preset: enabled)
Active: active (exited) since Mon 2018-05-28 15:30:18 CDT; 1min 32s ago
Process: 659 ExecStart=/usr/bin/zpool import -c /etc/zfs/zpool.cache -aN (code=exited, status=0/SUCCESS)
Process: 656 ExecStartPre=/sbin/modprobe zfs (code=exited, status=0/SUCCESS)
Main PID: 659 (code=exited, status=0/SUCCESS)
May 28 15:30:12 elephant systemd[1]: Starting Import ZFS pools by cache file...
May 28 15:30:18 elephant systemd[1]: Started Import ZFS pools by cache file.
● zfs-zed.service - ZFS Event Daemon (zed)
Loaded: loaded (/usr/lib/systemd/system/zfs-zed.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-05-28 15:30:18 CDT; 1min 32s ago
Docs: man:zed(8)
Main PID: 1586 (zed)
Tasks: 3 (limit: 4915)
Memory: 5.6M
CGroup: /system.slice/zfs-zed.service
└─1586 /usr/bin/zed -F
May 28 15:30:18 elephant systemd[1]: Started ZFS Event Daemon (zed).
May 28 15:30:18 elephant zed[1586]: ZFS Event Daemon 0.7.9-1 (PID 1586)
May 28 15:30:18 elephant zed[1586]: Processing events since eid=0
May 28 15:30:18 elephant zed[1591]: eid=1 class=history_event pool_guid=0x7314E37F1A1C0088
May 28 15:30:18 elephant zed[1593]: eid=2 class=config_sync pool_guid=0x7314E37F1A1C0088
May 28 15:30:18 elephant zed[1595]: eid=3 class=pool_import pool_guid=0x7314E37F1A1C0088
May 28 15:30:18 elephant zed[1618]: eid=5 class=config_sync pool_guid=0x7314E37F1A1C0088
● zfs-mount.service - Mount ZFS filesystems
Loaded: loaded (/usr/lib/systemd/system/zfs-mount.service; enabled; vendor preset: enabled)
Active: active (exited) since Mon 2018-05-28 15:30:12 CDT; 1min 38s ago
Process: 657 ExecStart=/usr/bin/zfs mount -a (code=exited, status=0/SUCCESS)
Main PID: 657 (code=exited, status=0/SUCCESS)
May 28 15:30:12 elephant systemd[1]: Starting Mount ZFS filesystems...
May 28 15:30:12 elephant systemd[1]: Started Mount ZFS filesystems.
[root@elephant ~]#
然而:
[root@elephant ~]# zfs mount
[root@elephant ~]#
[root@elephant ~]# zfs mount -a
[root@elephant ~]# zfs mount
backup /backup
backup/data /backup/data
backup/metadata /backup/metadata
backup/www /backup/www
我没有时间来处理这个问题,只能将所有数据集切换到旧式挂载,但我仍然很好奇为什么这对 zfs 0.6.x 有效,但不适用于 0.7.9 - 可能是某种 systemd 不兼容?
答案1
事实证明我的问题是我没有zfs-导入.目标启用。我甚至不确定当我第一次使用 ZoL 0.6.x 设置此系统时这个单元文件是否存在,但无论如何
systemctl enable zfs-import.target
解决了该问题。ZFS 数据集在启动时再次正确安装。