13
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ディレクトリはハードリンクできないのでバインドマウントしましょう。

Last updated at Posted at 2014-09-08
  • vagrantを使っている時、Vagrantfileで
    config.vm.synced_folderを設定すれば別ディレクトリにアクセスできますが、設定変更にはvagrant reloadしないといけないため

失敗

シンボリックリンクを貼った場合
$ ln -s ~/ansible_centos7_host link_ansible

スクリーンショット 2014-09-09 8.07.21.png

  • ゲストOSからホストのディレクトリにアクセス出来ない。
ディレクトリのハードリンクはできない
$ ln ~/ansible_centos7_host link_ansible
ln: `/home/vagrant/ansible_centos7_host`: ディレクトリに対するハードリンクは許可されていません

成功

バインドマウント
mkdir link_ansible
sudo mount --bind ~/ansible_centos7_host/ link_ansible/

スクリーンショット 2014-09-09 8.16.45.png

その他

  • バインドマウント一覧を確認
忘れるよね・・・
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/
13
16
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
13
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?