1

I'm using vagrant and have hashicorp/precise32 box. My projects in /products/ folder on this box. I want to reach this folder from my host computer. So added this configuration to my Vagrantfile

config.vm.synced_folder "/products","/products"

Also created /products folder on host. But after reload when I connect to box over SSH, /products folder's all contents are disappearing. When I comment out the config.vm.synced_folder line and reload, contents appering again.

Can you please tell me what's I missing?

Thank you.

Eray
  • 7,038
  • 16
  • 70
  • 120

1 Answers1

1

Vagrant sync folder works the other way around

Synced folders enable Vagrant to sync a folder on the host machine to the guest machine, allowing you to continue working on your project's files on your host machine, but use the resources in the guest machine to compile or run your project.

so if you have an existing folder on your guest machine and you ask vagrant to create a sync folder with one of your folder from the host, it will do but replace the content from the content of your host.

There is an old question with some good reference to understand it further

Community
  • 1
  • 1
Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
  • Hello Frederic, thank you for your response. What you are suggesting me to reach my project files from host ? I tried creating a symbolic link from my products folder to /vagrant folder. Because /vagrant folder mounting to host automatically. But in host computer symlink not working. – Eray Oct 09 '15 at 13:46
  • Hi Eray, I am afraid its not possible (at least I do not know of a way) usually you would work from the host and deploy files on guest not the other way around - if you need to get back from files from your VM copy them to vagrant folder then you will access them – Frederic Henri Oct 09 '15 at 14:14
  • So I should transfer my project files to host machine and deploy on guest machine. Give me a few minutes I will try now :) – Eray Oct 09 '15 at 14:25