Red Hat Training

A Red Hat training course is available for RHEL 8

16.5. 防止挂载点重复

这个流程将挂载点标记为 unbindable,因此不能在另一个挂载点中复制它。

流程

  • 要将挂载点的类型改为 unbindable 挂载,请使用:

    # mount --bind mount-point mount-point
    # mount --make-unbindable mount-point

    或者,要更改所选挂载点和其下的所有挂载点的挂载类型,请使用 --make-runbindable 选项,而不是 --make-unbindable 选项。

    重复此挂载的任何后续尝试都会失败,并显示以下错误:

    # mount --bind mount-point duplicate-dir
    
    mount: wrong fs type, bad option, bad superblock on mount-point,
    missing codepage or helper program, or other error
    In some cases useful info is found in syslog - try
    dmesg | tail  or so

例 16.4. 防止 /media 被复制

  • 要防止 /media 目录被共享,请使用:

    # mount --bind /media /media
    # mount --make-unbindable /media

其它资源

  • mount(8) 手册页