Last active
December 16, 2015 22:17
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# インストール | |
> vagrant plugin install vagrant-vbguest | |
# 確認 | |
> vagrant plugin list | |
: | |
vagrant-vbguest (0.11.0) | |
: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mount | grep vagrant | |
none on /vagrant type vboxsf (rw,nodev,relatime) | |
$ echo "foo\nbar" >> /vagrant/test.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> cat test.txt | |
foo | |
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
synced_folder("rsync", 5) do | |
require_relative "synced_folder" | |
SyncedFolder | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.synced_folder(name, priority=10, &block) | |
components.synced_folders.register(name.to_sym) do | |
[block.call, priority] | |
end | |
nil | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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