大网数据广告活动
服务器运维问答

Mount ZFS pool before snapd starts

· 52CE 我爱测

I have a zpool that has a mountpoint at /var . When I start my server up, the snapd service always throws a bunch of errors and fails to start because it attempts to mount a bunch of things from /var to /snap but it attempts the …

问题原文

原帖链接 · magikid · CC BY-SA 4.0

I have a zpool that has a mountpoint at /var. When I start my server up, the snapd service always throws a bunch of errors and fails to start because it attempts to mount a bunch of things from /var to /snap but it attempts the mounts before the zpool has been mounted so there's nothing in /var yet.

How can I get snapd to attempt these mounts after the zpool has been mounted?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

I had a similar issue with libvirtd wanting to start before ZFS had mounted its directory under /var and solved it with a systemd drop-in.

You can make an equivalent drop-in for snapd.service:

ubuntu@vmtest-ubuntu2004:~$ sudo mkdir /etc/systemd/system/snapd.service.d

ubuntu@vmtest-ubuntu2004:~$ cat <<EOF | sudo tee /etc/systemd/system/snapd.service.d/zfs.conf
[Unit]
Requires=zfs.target
After=zfs.target
EOF

ubuntu@vmtest-ubuntu2004:~$ sudo systemctl daemon-reload

This causes systemd to wait to start snapd until ZFS has finished starting up.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-02-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。