0

I just ran vagrant provision in a futile attempt at getting my customized synced_folders directive to work and now my whole guest box is wiped out.

Is this normal? I don't see any references to Vagrant docs about this behavior.

As per the doc:

Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process.

The only thing I have in my config provision shell commands are installation commands. Nothing about wiping anything out.

I do have app.vm.provision for puppet that sets fqdn, user name and box name (along with the normal module_path, manifests_path and manifests_file). Maybe this caused things to be reset?

earth2jason
  • 715
  • 1
  • 9
  • 20
  • What data specifically? – Don Branson Aug 07 '15 at 19:41
  • @Don Branson, all the data. Everything wiped out. Basically the User accounts were created again. Except this time without the "setup" I had on initial vagrant up. Just a bare bones Ubuntu install with Vagrant, Ubuntu and me users. – earth2jason Aug 07 '15 at 19:44
  • I figured out the issue as described below. A follow up question is found here - http://stackoverflow.com/questions/31895881/recover-data-on-guest-box-after-vagrant-sync-folders-of-empty-folder-on-host – earth2jason Aug 08 '15 at 16:10
  • use `vagrant reload --provision` – Connor Leech Aug 11 '20 at 20:56

2 Answers2

0

The Answer

Is Vagrant Provision suppose to wipe out all your data?

No. Vagrant should never harm your "data" (i.e., websites, code, etc.).

...now my whole guest box is wiped out. Is this normal?

Yes. Your Vagrant environment (in other words, the guest operating system created in a virtual environment by Vagrant) is volatile, and you should be able to destroy and recreate it at will without having any impact on your working files (because those should be kept in your local, or host, file system).

Explanation

On Vagrant's website, the very first thing they tell you is this:

Create and configure lightweight, reproducible, and portable development environments.

Your development environment allows you to work. You work on your data, in your development work environment. When you are done with your "development work environment," you should be able to delete it freely without affecting your data in the least.

Further, you should be able to send a collaborating developer your Vagrantfile so that they can create the exact same development environment you used to create your data (i.e., write your program, build your website, and so forth). Then, when you provide them with your code, they can use it in an environment identical to the one that your code was created in without having to reconfigure their own setup.

For more details about how your data files (code, working files, etc.) are kept safely in your computer while making them accessible to your guest system created by Vagrant, see my answer to this question.

Community
  • 1
  • 1
  • Thanks for the response, @unrivaledcreations. I agree with your sentiments but I don't think this answers the question but rather speaks of a convention. I do agree with your convention (or what appears to be normal convention) and appreciate your link as well as I will be studying that. – earth2jason Aug 07 '15 at 19:58
0

So what appears to have happened was that when I set up a synced folder, it wiped out everything because there was nothing on my host machine in that synced folder. Unless there is a way to recover the lost data, there should be an unmistakable WARNING in their docs that this can happen.

I setup the synced_folder to be on my whole home directory. When I created a new machine, I cloned the one project I had saved and decided to just sync my individual projects instead of my whole user directory this time. When I reloaded, the project directory was empty since it was empty on my host machine.

So I guess, make sure the directories on your host machine are already setup with the data before configuring your Vagrantfile with synced_folder information.

earth2jason
  • 715
  • 1
  • 9
  • 20