![Systemd 在启动期间无法挂载某些磁盘](https://linux22.com/image/943080/Systemd%20%E5%9C%A8%E5%90%AF%E5%8A%A8%E6%9C%9F%E9%97%B4%E6%97%A0%E6%B3%95%E6%8C%82%E8%BD%BD%E6%9F%90%E4%BA%9B%E7%A3%81%E7%9B%98.png)
我有一个运行 Ubuntu 20.04 LTS 的系统,其中有很多磁盘(大约 96 个数据驱动器,格式化为 xfs)。在启动过程中,systemd 设法挂载了大多数驱动器,但无法完全挂载 /etc/fstab 中列出的大约 20 个驱动器。
该系统有多个 24 托架 SAS 机架连接在一起,我使用fstab 文件中/mnt/shelf/shelf#/disk#
的标签引用设备(例如/dev/disk/by-label/disk-###
:)进行安装。fstab 文件很长,但所有数据磁盘安装行都相同,如下所示:
*snip*
/dev/disk/by-label/disk-501 /mnt/shelf/5/501 xfs defaults 0 0
/dev/disk/by-label/disk-502 /mnt/shelf/5/502 xfs defaults 0 0
/dev/disk/by-label/disk-503 /mnt/shelf/5/503 xfs defaults 0 0
*snip*
奇怪的是,总是 fstab 底部的磁盘发生故障。当我查看系统日志时,我发现以下条目似乎相关:
Nov 26 09:13:16 h2 systemd[1]: Found device HUS724040ALS640 disk-092.
Nov 26 09:13:16 h2 systemd[1]: Found device HUS724040ALS640 disk-096.
Nov 26 09:13:16 h2 systemd[1]: Mounting /mnt/shelf/4/092...
Nov 26 09:13:16 h2 systemd[1]: Mounting /mnt/shelf/4/096...
Nov 26 09:13:16 h2 systemd[1]: Mounted /mnt/shelf/1/014.
Nov 26 09:13:16 h2 systemd[1]: Mounted /mnt/shelf/3/069.
Nov 26 09:13:16 h2 systemd[1]: Found device HUS724040ALS640 disk-088.
Nov 26 09:13:16 h2 systemd[1]: Mounting /mnt/shelf/4/088...
Nov 26 09:13:16 h2 systemd[1]: Mounted /mnt/shelf/4/092.
Nov 26 09:13:16 h2 systemd[1]: Mounted /mnt/shelf/4/096.
*snip*
Nov 26 09:13:16 h2 systemd[1]: mnt-shelf-4-073.mount: Job mnt-shelf-4-073.mount/start failed with result 'dependency'.
Nov 26 09:13:16 h2 systemd[1]: dev-disk-by\x2dlabel-disk\x2d073.device: Job dev-disk-by\x2dlabel-disk\x2d073.device/start failed with result 'timeout'.
Nov 26 09:13:16 h2 systemd[1]: dev-disk-by\x2dlabel-disk\x2d074.device: Job dev-disk-by\x2dlabel-disk\x2d074.device/start timed out.
Nov 26 09:13:16 h2 systemd[1]: Timed out waiting for device /dev/disk/by-label/disk-074.
Nov 26 09:13:16 h2 systemd[1]: Dependency failed for /mnt/shelf/4/074.
Nov 26 09:13:16 h2 systemd[1]: mnt-shelf-4-074.mount: Job mnt-shelf-4-074.mount/start failed with result 'dependency'.
启动后,我通过手动安装启动期间失败的磁盘来解决此问题。
我相信存在某种 systemd 启动顺序问题(也许缺少我可以使用的 fstab 选项?)或依赖性问题,导致 systemd 超时等待磁盘设备正确完全枚举。
关于我可以从哪里开始查看,有什么想法吗?