AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

    • 主页
    • 系统&网络
    • Ubuntu
    • Unix
    • DBA
    • Computer
    • Coding
    • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 868682
Accepted
Tom Hale
Tom Hale
Asked: 2017-08-15 23:47:44 +0800 CST2017-08-15 23:47:44 +0800 CST 2017-08-15 23:47:44 +0800 CST

`mount --make-private /` 的含义

  • 772

目前,/已共享挂载传播:

# findmnt -o TARGET,PROPAGATION /
TARGET PROPAGATION
/      shared

我正在考虑将其更改private为能够mount --move在安装在/mnt和/media.

(我想使用mount --move而不是 unsafe umount --lazy)

如果没有/,private会mount --move抱怨类似:

# mount --move /mnt/mountpoint /mnt/moved
mount: /mnt/moved: bad option; moving a mount residing under a shared mount is unsupported.
  1. 为什么是/ shared默认的?

  2. /改变成为的含义是private什么?

linux
  • 1 1 个回答
  • 2625 Views

1 个回答

  • Voted
  1. Best Answer
    Andrii L.
    2017-08-16T05:47:24+08:002017-08-16T05:47:24+08:00

    传播标志由 更改systemd。来自man 7 mount_namespaces:

    systemd(1) 在系统启动时自动将所有挂载点重新挂载为 MS_SHARED。因此,在大多数现代系统上,默认传播类型实际上是 MS_SHARED。

    来自https://github.com/systemd/systemd/blob/master/src/core/mount-setup.c#L406

      /* Mark the root directory as shared in regards to mount propagation. The kernel defaults to "private", but we
         * think it makes more sense to have a default of "shared" so that nspawn and the container tools work out of
         * the box. If specific setups need other settings they can reset the propagation mode to private if
         * needed. Note that we set this only when we are invoked directly by the kernel. If we are invoked by a
         * container manager we assume the container manager knows what it is doing (for example, because it set up
         * some directories with different propagation modes). */
        if (detect_container() <= 0)
                if (mount(NULL, "/", NULL, MS_REC|MS_SHARED, NULL) < 0)
    

    含义取决于您的特定用例。我认为大多数程序将继续有效。但是,您的更改将在重新启动时被覆盖。

    您可以在https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739593中 Lennart Poettering 的评论中阅读更多内容

    这是其中的一部分:

    b) 如果您修补 systemd 以返回根目录的 MS_PRIVATE,您将禁用传播到容器,并且没有人可以再为其特定命名空间选择加入它。

    优点:您不必修补那些当前假定根目录为 MS_PRIVATE 并且不会取消关联的程序。

    缺点:对于那些为 / 切换到 MS_SHARED 的人来说,应用程序仍然被破坏。因此,您只涵盖人们不分离的用例。你打破了人们希望传播到其他地方的用例。

    • 3

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助
subwaysurfers
my femboy roommate

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve