- vagrantを使っている時、Vagrantfileで
config.vm.synced_folder
を設定すれば別ディレクトリにアクセスできますが、設定変更にはvagrant reload
しないといけないため
失敗
シンボリックリンクを貼った場合
$ ln -s ~/ansible_centos7_host link_ansible
- ゲストOSからホストのディレクトリにアクセス出来ない。
ディレクトリのハードリンクはできない
$ ln ~/ansible_centos7_host link_ansible
ln: `/home/vagrant/ansible_centos7_host`: ディレクトリに対するハードリンクは許可されていません
成功
バインドマウント
mkdir link_ansible
sudo mount --bind ~/ansible_centos7_host/ link_ansible/
その他
- バインドマウント一覧を確認
忘れるよね・・・
grep home /proc/mounts
バインドマウントしたものは以下特徴あり(真似しないように)
$ mv link_ansible/ aa
mv: `link_ansible/` から `aa` へ移動できません: デバイスもしくはリソースがビジー状態です
$ rm -rf link_ansible
rm: `link_ansible` を削除できません: デバイスもしくはリソースがビジー状態です
$ ls -l link_ansible
# フォルダの中身は空になるので注意!
httpd
DocumentRootの差し替えに便利かもしれない。
mount
$ sudo mount --bind /usr/share/hoge/htdocs/ /var/www/
これならapache再起動不要。
umount
$ sudo umount /var/www/