跳转至

SOP — 客户端 /mnt/lustre 挂载恢复 + fstab noatime 对齐

  • 主题目录:fix-client-mount-20261007/
  • 执行日期:2026-10-07
  • 类型:C 类变更(客户端挂载与 fstab 变更)
  • 关联:docs/HANDOFF.md §3.1 #14 / #16(本变更结案);slurm_ins/eda_topo_audit_20261006/ §5 G1/G2(已移交项)

1. 背景

两件事合并一次执行:

  1. #14(2026-10-06 发现):4 台节点 /mnt/lustre 未挂载——.21(管理/验证客户端,与 MGS+MDT 同机)、.25/.26/.27(LSF 执行节点)。四台的 mnt-lustre.mount 均为 failed (Result: timeout),起始时间 2026-09-29 18:41–18:45,失败已 8 天无人察觉。journal 原文:Mounting timed out. Terminating. → code=killed, status=15/TERM。
  2. #16(2026-10-07):modules/client_mount.py::_fstab_entry() 已把 fstab 模板由 defaults,nofail 改为 defaults,noatime,nofail(与 slurm_ins storage_layout.tier0_mount_options 对齐),但源已改、现场未变。

根因(与 env_facts_sync_20261004/SOP.md 附录 A 同源):客户端 fstab 带 nofail,启动期 MDS 客户端恢复窗口拒连时 mount.lustre 挂起,systemd 90 s 后判 timeout 杀进程、unit 置 failed;失败被 nofail 静默吞掉,无重试、无告警。slurm 计算节点 .18–.20 同源配置却已挂上,说明非 Lustre 服务端不可用,纯属启动期竞态。

标准符合性:EDA 存储标准 S1(三层物理分离)/ S5(跑作业节点统一视图)要求 Tier0 Lustre scratch 在跑作业节点可见——.25–.27 不满足。

2. 目标

项 可验证状态
挂载 .21/.25/.26/.27 的 mnt-lustre.mount 为 active,findmnt -t lustre 可见
参数 挂载选项含 noatime(现场与 storage_layout.tier0_mount_options 对齐)
持久化 /etc/fstab 中 lustre 条目唯一,含 noatime 与 nofail,语法合法
可用性 rain01 在 4 台真实写入 /mnt/lustre/scratch/tmp 成功
幂等 复跑零变更(systemctl start rc=0、仍 active,fstab 不追加)
边界 不改 Lustre 服务端配置、不改目录权限、不重挂载其他节点、不重启主机

3. 前置条件

  • root 免密 SSH 可达 4 台(本机 192.168.31.249)
  • Lustre 服务端在线:.21 的 /mnt/mdt0 已挂载(MGS/MDS 就绪)
  • 服务端身份源条目已就位:design(2000) / rain01(2001)(见 fix-lustre-write-perm/SOP.md)
  • 目标端当前 /mnt/lustre 为 absent,无在跑作业依赖该挂载点,无需停服

4. 影响范围

主机 角色 变更内容 停服 窗口
192.168.31.21 管理/验证客户端(同 MGS+MDT) fstab 条目加 noatime;恢复挂载 否 单台 <10 s
192.168.31.25/.26/.27 LSF 执行节点 同上 否 单台 <10 s
  • 不重启 lnet / 不重挂载其他客户端 / 不重启 Lustre 服务端;.18/.19/.20/.28 不动
  • 挂载动作可逆(umount);fstab 条目保留 nofail,不会导致开机卡死

5. 分步操作

实现体说明:本次未走工程 modules/client_mount.py,原因两条:① 该模块以 mount -t lustre 挂载,与红线「fstab 含 nofail 时手工 mount 报 rc=-22」冲突(systemctl start mnt-lustre.mount 才会由 systemd 剥离 nofail);② 模块的 append_to_fstab() 用 grep -F <完整条目> 判重,对已存在的旧条目(无 noatime)不匹配,会追加出第二条 /mnt/lustre 条目。故本步以等价 shell 实施。

步骤 1:备份 4 台 /etc/fstab

改 fstab 属高危动作,先做可回滚备份(备份是兜底,不是可选项)。

ts=$(date +%Y%m%d-%H%M%S)
for h in 21 25 26 27; do
  ssh root@192.168.31.$h "cp /etc/fstab /etc/fstab.bak.$ts && ls -l /etc/fstab.bak.$ts"
done

预期:每台返回备份文件路径,大小 671 B(.21)/ 1095 B(.25–.27)。 失败判断:cp 报错即中止该台,不得继续改动。

步骤 2:sed 就地补 noatime

只匹配含 /mnt/lustre lustre 的行,且已含 noatime 则不动(幂等)。

for h in 21 25 26 27; do
  ssh root@192.168.31.$h \
    "sed -i -e '/\/mnt\/lustre lustre/{/noatime/!s/defaults,/defaults,noatime,/}' /etc/fstab && grep -n 'mnt/lustre' /etc/fstab"
done

预期:每台恰好一行(.21 保留 x-systemd.requires-mounts-for=/mnt/mdt0):

192.168.31.21@tcp:/edafs /mnt/lustre lustre defaults,noatime,nofail 0 0

坑:sed 表达式必须限定在 lustre 行内,否则会误改其他挂载项的 defaults,。

步骤 3:重挂载

fstab 变更后需 daemon-reload 让 generator 重建 unit;reset-failed 清掉 9-29 遗留的失败态,否则 start 会被判 no-op。

for h in 21 25 26 27; do
  ssh root@192.168.31.$h \
    "systemctl daemon-reload; systemctl reset-failed mnt-lustre.mount; systemctl start mnt-lustre.mount; echo rc=\$?"
done

预期:rc=0,随后 systemctl is-active mnt-lustre.mount → active。 失败判断:Result=timeout 复现 → 见第 7 章回滚;若为 MOUNT_ABSENT 且 journal 显示 no such user → 服务端身份源条目缺失,回到 fix-lustre-write-perm/SOP.md。

步骤 4:验证(见第 6 章)

6. 验证

for h in 21 25 26 27; do
  ssh root@192.168.31.$h \
    "systemctl is-active mnt-lustre.mount; \
     findmnt -t lustre -no OPTIONS --target /mnt/lustre; \
     grep -c '/mnt/lustre lustre' /etc/fstab; \
     findmnt --verify --fstab 2>&1 | tail -3; \
     runuser -u rain01 -- touch /mnt/lustre/scratch/tmp/.probe && echo WRITE_OK"
done

实测结果(2026-10-07 09:00–09:02)

主机 unit findmnt 选项含 noatime fstab 条数 findmnt --verify rain01 写入
.21 active 是 1 0 parse errors / 0 errors / 2 warnings WRITE_OK
.25 active 是 1 同上 WRITE_OK
.26 active 是 1 同上 WRITE_OK
.27 active 是 1 同上 WRITE_OK
  • 幂等复跑:再次 systemctl start mnt-lustre.mount → rc=0、仍 active,fstab 未追加
  • 旁证:MDS .21 近 15 分钟 l_getidentity 日志 0 条
  • 2 条 warning 为 unreachable source: 192.168.31.21@tcp:/edafs(findmnt 不认 Lustre 源,非本地路径),属正常噪声,非语法错误

7. 回滚

备份位置(远程原位 + 本工程副本,逐条见 backup/README.md):

  • 远程:/etc/fstab.bak.20261007-090030(4 台原位保留,权限 644)
  • 工程:fix-client-mount-20261007/backup/<主机IP>/etc/fstab.bak.20261007-090030(600)
# 回滚 fstab
for h in 21 25 26 27; do
  ssh root@192.168.31.$h "cp /etc/fstab.bak.20261007-090030 /etc/fstab && systemctl daemon-reload"
done
# 卸载挂载(回到变更前 absent 态)
for h in 21 25 26 27; do
  ssh root@192.168.31.$h "systemctl stop mnt-lustre.mount"
done

回滚后验证:systemctl is-active mnt-lustre.mount → inactive,grep -c '/mnt/lustre lustre' /etc/fstab → 1(旧条目),与变更前一致。

回滚触发条件(量化):① systemctl start 非 0 或 90 s 内未到 active;② /mnt/lustre 挂载后 rain01 写入失败;③ fstab 条数 ≠ 1 或 findmnt --verify 报 parse error。任一命中即回滚。

8. 风险说明

风险 缓解
改 fstab 导致开机挂载失败卡死 条目保留 nofail;findmnt --verify 复核语法;变更前备份
sed 误改其他挂载项 表达式限定 /mnt/lustre lustre 行;改后逐台 grep -n 复核(仅 1 行)
与工程模块冲突(重复 fstab 条目) 已识别 append_to_fstab() 全行比对缺陷,本次规避;模块侧缺陷见「遗留」
启动期竞态复发(重启后再次 failed) 本次未纳入范围:.25–.27 不在 slurm_ins 自愈机制 B(.16 的 slurm-cluster-health.timer 仅巡 .18–.20/.28)覆盖范围内——见「遗留」

9. 遗留(下一轮候选)

  1. 自愈覆盖缺口:.25/.26/.27(LSF 执行节点)重启后仍可能因同一竞态落 failed 且无人察觉。机制 B 的巡检清单需扩到这三台(或改由 LSF 侧 timer 覆盖)。
  2. client_mount 模块两处缺陷(本次手工规避,未改代码):① 挂载用 mount -t lustre,遇到已有 fstab 条目会因 nofail 报 rc=-22,应改用 systemctl start mnt-lustre.mount;② append_to_fstab() 无法就地更新旧条目,会追加重复行。
  3. HANDOFF red-line 与环境事实:Lustre 客户端 fstab 口径(defaults,noatime,nofail)已与 slurm_ins 对齐,属稳定事实,宜入 docs/BASELINE.md。

来源:/home/rain/Documents/lustre_ins/fix-client-mount-20261007/SOP.md | 最后更新:2026-10-07 09:01(由 build/sync.py 同步,请勿在站点侧修改)