Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant destroyed on host shut down, Windows

After working in a Vagrant VM and making some changes I will suspend the VM using vagrant suspend. If I then restart the host computer and then attempt to run vagrant resume, the terminal sits for a bit and then brings me back to a command prompt without any feedback. So, naturally I then try vagrant ssh, and I receive the following:

VM must be running to open SSH connection. Run vagrant up to start the virtual machine.

If I run vagrant up, I find that all the changes I made prior to the suspend have been overwriten by the base box import.

Is this intended behavior? I am runny Windows 8 pro x64.

like image 698
spetz83 Avatar asked Jul 12 '13 18:07

spetz83


People also ask

How do I stop vagrant shutdown?

Command: vagrant halt [name|id] This command shuts down the running machine Vagrant is managing. Vagrant will first attempt to gracefully shut down the machine by running the guest OS shutdown mechanism. If this fails, or if the --force flag is specified, Vagrant will effectively just shut off power to the machine.

How do I resume my vagrant box?

Command: vagrant resume [name|id] This resumes a Vagrant managed machine that was previously suspended, perhaps with the suspend command. The configured provisioners will not run again, by default. You can force the provisioners to re-run by specifying the --provision flag.

What does vagrant destroy do?

Command: vagrant destroy [name|id] This command stops the running machine Vagrant is managing and destroys all resources that were created during the machine creation process. After running this command, your computer should be left at a clean state, as if you never created the guest machine in the first place.

How do I end a vagrant session?

Once you are done exploring the virtual machine, you can exit the session with CTRL-D.


1 Answers

The idea of vagrant is to use the base box and then make customizations with provisioning methods. So always a vagrant destroy (removes all data of the VM) and vagrant up builts the box again, based on the base box, should work.

Anyways, you did not do a vagrant destroy the data should still be there.

If you did a vagrant suspend that means the boxes state is frozen by Virtual Box.

Next, you should do a vagrant resume: http://docs.vagrantup.com/v2/cli/resume.html

But if you did a vagrant up in between, the data might be lost. You could open the VirtualBox GUI and see if there are still some preserved snapshots.

like image 130
Alex Avatar answered Nov 13 '22 07:11

Alex