Skip to content

Instantly share code, notes, and snippets.

@m-nori
Created January 11, 2013 03:09
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-nori/4507653 to your computer and use it in GitHub Desktop.
Save m-nori/4507653 to your computer and use it in GitHub Desktop.
VirtualBoxで共有フォルダを作る方法

VirtualBoxで共有フォルダを作る方法

共有フォルダをそのまま作るとシンボリックリンクが貼れなかったりするので、以下の方法で作成する。


VirtualBoxマネージャで共有フォルダを作成

Windows側で以下の操作を行う。

  • VertualBoxマネージャで設定を開いて、共有フォルダーを選択。
  • 「自動マウント」、「永続化する」を選択してフォルダーを作成。

ユーザに権限を追加

共有フォルダはUbuntu上の/media配下に自動マウントされる。
しかし、この状態だとユーザが操作できないのでUbuntu側で以下の操作をしてユーザをvboxsfグループに追加する。

> sudo gpasswd -a ユーザ名 vboxsf

コマンド実行後再起動する。

シンボリックリンクを作成できるようにする

この状態だと共有フォルダ上にシンボリックリンクが作れないので「npm install -d」とかやるとエラーになる。
なので、Windows側で以下のコマンドを実行する。

> cd /D "C:\Program Files\Oracle\VirtualBox"
> VBoxManage.exe setextradata 仮想マシン名 VBoxInternal2/SharedFoldersEnableSymlinksCreate/共有フォルダ名 1

コマンド実行後再起動する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment