如果磁盘挂载点导出无法挂载,如何启动 NFS 服务器?

如果磁盘挂载点导出无法挂载,如何启动 NFS 服务器?

考虑以下/etc/exports

/verbatim 192.168.0.0/255.255.255.0(rw,sync,no_subtree_check)
/sandisk 192.168.0.0/255.255.255.0(rw,sync,no_subtree_check)

/verbatim并且/sandisk是外部硬盘的挂载点,定义/etc/fstab如下:

/dev/disk/by-uuid/06b24834-a749-4d93-b0d5-a6da71eaf224 /verbatim ext4 defaults 0 1
/dev/disk/by-uuid/d7dbea69-0332-4d12-b905-b9a116e28422 /sandisk ext4 defaults 0 1

现在,如果任何硬盘无法挂载(例如,当硬盘关闭或拔出时),NFS 服务器将无法启动。我认为日志中的相关条目如下:

Sep 23 09:45:26 lilo systemd[1]: dev-disk-by\x2duuid-06b24834\x2da749\x2d4d93\x2db0d5\x2da6da71eaf224.device: Job dev-disk-by\x2duuid-06b24834\x2da749\x2d4d93\x2db0d5\x2da6da71eaf224.device/start timed out.
Sep 23 09:45:26 lilo systemd[1]: Timed out waiting for device SAMSUNG_HD204UI 1.
Sep 23 09:45:26 lilo systemd[1]: Dependency failed for File System Check on /dev/disk/by-uuid/06b24834-a749-4d93-b0d5-a6da71eaf224.
Sep 23 09:45:26 lilo systemd[1]: Dependency failed for /verbatim.
Sep 23 09:45:26 lilo systemd[1]: Dependency failed for NFS server and services.
Sep 23 09:45:26 lilo systemd[1]: nfs-server.service: Job nfs-server.service/start failed with result 'dependency'.
Sep 23 09:45:26 lilo systemd[1]: verbatim.mount: Job verbatim.mount/start failed with result 'dependency'.
Sep 23 09:45:26 lilo systemd[1]: systemd-fsck@dev-disk-by\x2duuid-06b24834\x2da749\x2d4d93\x2db0d5\x2da6da71eaf224.service: Job systemd-fsck@dev-disk-by\x2duuid-06b24834\x2da749\x2d4d93\x2db0d5\x2da6da71eaf224.service/start failed with result 'dependency'.
Sep 23 09:45:26 lilo systemd[1]: dev-disk-by\x2duuid-06b24834\x2da749\x2d4d93\x2db0d5\x2da6da71eaf224.device: Job dev-disk-by\x2duuid-06b24834\x2da749\x2d4d93\x2db0d5\x2da6da71eaf224.device/start failed with result 'timeout'.

有什么方法可以配置 NFS 服务器来启动并为其他驱动器(sandisk)提供服务,即使某些驱动器无法安装(逐字)?

答案1

mountpoint将或选项添加mp到您的 /etc/exports。这将 1) 阻止 nfs-server-generator 为该路径添加 systemd 依赖项,以及 2) 在将exportfs文件系统标记为导出之前验证它是否已挂载。

(可以使用 查看自动生成的依赖项systemctl cat nfs-server,并在末尾显示额外的文件“order-with-mounts.conf”,并使用 进行刷新systemctl daemon-reload。)

相关内容