LoginSignup
3
3

More than 5 years have passed since last update.

マウント済のディレクトリ内ファイルを参照したいとき

Last updated at Posted at 2014-01-28

手違いでマウントポイントとして利用してるディレクトリ内にファイル作成しちゃいます。

touch /mnt/hoge
file /mnt/hoge
# /mnt/hoge: empty

その状態で何らかをマウントしちゃったらファイルが参照できなくなりました。
そして、アンマウントするのは何らかの事情で不可ということがありますね。

mount -t tmpfs /dev/shm /mnt
file /mnt/hoge
# /mnt/hoge: cannot open `/mnt/hoge' (No such file or directory)

マウントポイントに利用してるディレクトリを含むパーティションを
どこか他のとこにアタッチしてやるとホッとします。

mkdir -p /tmp/ya-root
mount --bind / /tmp/ya-root
file /tmp/ya-root/mnt/hoge
# /tmp/ya-root-mnt/hoge: empty
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3