環境:ubuntu15.10(systemd)
ここを参照して勉強しています。
マウントの名前空間の検証までいきましたが、いまいち理解ができていません。
$ sudo unshare --mount /bin/bash # touch /root/hosts # mount -o bind /etc/hosts /root/hosts # ls -li /root/hosts 4194314 -rw-r--r-- 1 root root 224 Jul 13 2012 /root/hosts # cat /root/hosts 127.0.0.1 localhost (略)
$ sudo -s # ls -l /root/hosts -rw-r--r-- 1 root root 0 May 17 14:01 /root/hosts # cat /root/hosts # (結果通り表示されませんでした。)
質問です。
1.
mount名前空間に入って/root/hostsの内容があるかなと思っていたのですがありませんでした。
$ sudo unshare --mount /bin/bash #cat /root/hosts (この時点で再度マウントの名前空間に入っていると思って、中身見ようとしたらありませんでした。)
消えた/root/hostsの中身を再度見るにはどうしたらいいですか?
2.マウントしたときに/etc/hostsと/root/hostsのinode番号が同じでした。
echo hello >> /etc/hosts
を実行後
tail -1 /root/hosts
をみたらhelloという文字がありませんでした。
inode番号が同じだと反映されると思っています。
間違っているのでしょうか?
あなたの回答
tips
プレビュー