Skip to content

Instantly share code, notes, and snippets.

@tobynet
Last active December 16, 2015 22:17
Show Gist options
  • Save tobynet/f23cd9c41298885a0106 to your computer and use it in GitHub Desktop.
Save tobynet/f23cd9c41298885a0106 to your computer and use it in GitHub Desktop.
vagrant において、明示的に VirtualBox の機能(vboxsf)を使いフォルダを同期するには、`config.vm.synced_folder ".", "/vagrant", type: "virtualbox"` のように Vagrantfile に設定するとよい ref: http://qiita.com/toby_net/items/6eb74471871ab9fba087
# インストール
> vagrant plugin install vagrant-vbguest
# 確認
> vagrant plugin list
:
vagrant-vbguest (0.11.0)
:
diff --git a/Vagrantfile b/Vagrantfile
index xxxxxx..xxxxxx 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -38,6 +38,7 @@ Vagrant.configure(2) do |config|
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
+ config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
$ mount | grep vagrant
none on /vagrant type vboxsf (rw,nodev,relatime)
$ echo "foo\nbar" >> /vagrant/test.txt
> cat test.txt
foo
bar
synced_folder("rsync", 5) do
require_relative "synced_folder"
SyncedFolder
end
def self.synced_folder(name, priority=10, &block)
components.synced_folders.register(name.to_sym) do
[block.call, priority]
end
nil
end
synced_folder(:virtualbox) do
require File.expand_path("../synced_folder", __FILE__)
SyncedFolder
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment