今回は実際にVagrantを使って仮想マシンを立ち上げます。…
Vagrantfileをおいていたディレクトリを別のディレクトリに移す必要があったので、今回はその方法をご紹介します。
Vagrantfilewを置いていたディレクトリをVagrantの共有フォルダとしても使っていたのであわせて設定していきます。
以下のディレクトリ・ファイルを新しいディレクトリに移動します。
これ以外にも設置しているファイルがあれば移動します。
- .vagrnt
- Vagrantfile
.vagrantは不可視ファイルになっているのでターミナルで不可視ファイルを見えるように設定しておきましょう。
これだけでvagrant upで起動できるようになりますが、以下のようなエラーが出ます。
==> default: This machine used to live in /Volumes/hoge/www but it's now at /Volumes/hoge-new/. ==> default: Depending on your current provider you may need to change the name of ==> default: the machine to run it as a different machine.
これは共有フォルダの設定が元のディレクトリになっているために起こります。
こちらのディレクトリの変更をVirtualBoxで行っていきます。

VirtualBoxで共有フォルダを変更したいVMを指定し「共有フォルダー」をクリックします。

共有フォルダーをダブルクリックします。

「フォルダーのパス」に新しいフォルダのパスを入力して設定を保存します。
これでディレクトリを移すことができました。