サブフォルダ内に親フォルダをマウントするとどうなりますか?

サブフォルダ内に親フォルダをマウントするとどうなりますか?

ディレクトリがあります/dir1/dir1/sdir2次のコマンドを実行するとどうなりますか?

mount --bind /dir1 /dir1/sdir2

ディレクトリループが作成されると思いましたが、ループはレベル1で終了します。

上記のコマンドがディレクトリループを生成しない理由を説明できる人はいますか?

ベストアンサー1

バンドルインストールでは、インストールは元のディレクトリ内にあり、もはや伝播されません。これを行うには、--rbind.fromを使用してください。mountマンページ:

Bind mount operation
   Remount part of the file hierarchy somewhere else.  The call is:

          mount --bind olddir newdir

   [...]

   The bind mount call attaches only (part of) a single filesystem, not
   possible submounts.  The entire file hierarchy including submounts is
   attached a second place by using:

          mount --rbind olddir newdir

しかし、これはサブマウントを一度だけ伝播するので、まだループはありません。

% mkdir -p foo/bar
% sudo mount --rbind foo foo/bar
% ls foo
bar
% ls foo/bar
bar
% ls foo/bar/bar

インストールを再帰的かつ無限に伝播する方法はないと思います。

おすすめ記事