搜索

19.7. 使用 systemd.automount 在 /etc/fstab 按需挂载文件系统

download PDF

这个步骤演示了如何在 /etc/fstab 中定义挂载点时,使用自动挂载 systemd 单元根据需要挂载文件系统。您必须为每个挂载添加自动挂载单元并启用它。

流程

  1. 添加所需的 fstab 条目,如 永久挂载文件系统 中所述。例如:

    /dev/disk/by-id/da875760-edb9-4b82-99dc-5f4b1ff2e5f4  /mount/point  xfs  defaults  0 0
  2. x-systemd.automount 添加到上一步中创建的条目的 options 字段中。
  3. 加载新创建的单元,以便您的系统注册新配置:

    # systemctl daemon-reload
  4. 启动自动挂载单元:

    # systemctl start mount-point.automount

验证

  1. 检查 mount-point.automount 是否正在运行:

    # systemctl status mount-point.automount
  2. 检查自动挂载的目录是否有所需的内容:

    # ls /mount/point

其它资源

  • systemd.automount(5) 手册页
  • systemd.mount(5) 手册页
  • 管理 systemd
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.