除此之外,我还有 LUKS 加密驱动器和 ZFS。我使用脚本在启动时解锁驱动器。我为此做了一个 systemd 服务,但是脚本需要一些时间,并且 zfs-import-cache.service 在我的脚本完成之前启动。
- zfs-import-cache.service Journalctl
# journalctl -e -u cryptdisks-unlock.service -u zfs-import-cache.service
Sep 25 15:53:45 server systemd[1]: Starting Unlock LUKS drives...
Sep 25 15:53:45 server boot[1216]: Decrypting evo850m21-crypt ...
Sep 25 15:53:47 server systemd[1]: Starting Import ZFS pools by cache file...
Sep 25 15:53:47 server boot[1216]: Device evo850m21-crypt decrypted.
Sep 25 15:53:47 server boot[1216]: Decrypting evo850m22-crypt ...
Sep 25 15:53:49 server boot[1216]: Device evo850m22-crypt decrypted.
Sep 25 15:53:49 server boot[1216]: Decrypting st30001-crypt ...
Sep 25 15:53:50 server zpool[1390]: cannot import 'data': no such pool or dataset
Sep 25 15:53:51 server zpool[1390]: Destroy and re-create the pool from
Sep 25 15:53:51 server zpool[1390]: a backup source.
Sep 25 15:53:51 server systemd[1]: zfs-import-cache.service: Main process exited, code=exited, status=1/FAILURE
Sep 25 15:53:51 server systemd[1]: zfs-import-cache.service: Failed with result 'exit-code'.
Sep 25 15:53:51 server systemd[1]: Failed to start Import ZFS pools by cache file.
Sep 25 15:53:52 server boot[1216]: Device st30001-crypt decrypted.
Sep 25 15:53:52 server boot[1216]: Decrypting st30002-crypt ...
Sep 25 15:53:54 server boot[1216]: Device st30002-crypt decrypted.
Sep 25 15:53:54 server systemd[1]: cryptdisks-unlock.service: Succeeded.
Sep 25 15:53:54 server systemd[1]: Finished Unlock LUKS drives.
cryptdisks-unlock.service
[Unit]
Description=Unlock LUKS drives
Before=zfs-import.target
[Service]
Type=oneshot
ExecStart=/usr/local/cryptdisks-tools/boot
[Install]
WantedBy=zfs-import-cache.service