Should I use vagrant halt before restarting host - vagrant

I am kind of new to using vagrant with oracle's virtual box. I was wondering if anyone knows if it is a good idea or not to use vagrant halt before restarting or rebooting my host machine?

Vagrant halt
is another way of saying shutdown; it is a good practice to do that since it will attempt to shut the VM gracefully where as windows will force it to. As a result you may sometimes get an error saying the VM wasn't shut properly and is now on a protected mode or saved mode and need to be rebuilt.

Related

Failed to boot vagrant box 'TIME OUT'

I'm using vagrant inside the linux VM using VMWare and the hosted machine is windows-base. So it's a virtual machine inside a virtual machine.
So when I try to boot the vagrant box I got this error
When I google I couldn't able to find the exact solution for this but here in this question Vagrant up timeout #BrainC pointed out that enable GUI mode from vagrant config file it will give you better idea what exactly going wrong here. but still I couldn't able to find any cause of the problem!
So what's the really issue here... is it because of virtual-machine inside virtual-machine or it's something else.
UPDATE:
when i enabled gui option in vagrantfile gui opens it shows some error BUT IT happend so fast I couldn't able to see it, so I've recorded the screen and this is what i got

vagrant - shutting down host machine

I am pretty new to vagrant. I have installed an ubuntu 14.04 trusty box on my vagrant and will use it for my web development environment. I want to know which is the best way to disable/close/shutdown a vagrant box so that data in it remain safe in the next session? I mean when I want to shutdown my laptop (in windows 10, my host machine os is win10) there is a message telling me that virtualbox interface is open. so if I close the process then I cant access vagrant box anymore. I want a good way to close vagrant and run it in my next working session.
I read about vagrant halt before host shutdown and using vagrant up in next session but it takes too long to run a vagrant up.
**summary : I WANT A WAY TO DO THIS:
1- close a vagrant box without a data loss in it;
2- shutdown my laptop without seeing the message that tells virtualbox interface is open.
3- run vagrant box and access it with putty as fast as possible when I start working again.
is there a way to do this?**
thanks.
I want to know which is the best way to disable/close/shutdown a vagrant box so that data in it remain safe in the next session
I would not necessarily to recommend vagrant halt which will completely stop your VM and will need to start up after you restart your host.
You can run vagrant suspend which will hold your data and you will retrieve your instance in the same state as it was before on your next startup
You can read more about the differences between halt and suspend

does "vagrant destroy" erase apache configs?

I'm new to vagrant, I'm using scotchbox.
I've configured a couple of vhosts in apache.
I guess the right way to do this would have been to change the provisionning of my box (as it's the aim of vaghrant right?) but i did the old school way by simpply editing my config files and so on...
Now my question is :
if i run vagrant destroy, do i loose all my configs?
is there any other command (vagrant halt, vagrant suspend?) that would allow me to reboot my host machine without loosing my config?
vagrant destroy will remove entire VM so any changes that were made manually will be lost. Vagrant halt only turns of the power so to speak so nothing is lost. If you run your machine again or reboot it all your data is save, just don't use --provision option that will recreate all initial configuration.

What happens with guest VMs if host running Vagrant is powered off?

Imaging I am running a Virtual Machine guest (VM) managed by Vagrant and hosted by VirtualBox on Windows. What happens if the HOST is abruptly powered off? Is whatever data that has been added/updated to the VM lost? If this is the case, must I run vagrant halt to insure nothing is lost? Perhaps vagrant suspend would be sufficient?
Thank you for any insights or recommendations.
If the host crashes, the VirtualBox VMs will end to aborted state, but in many cases vagrant up should be enough to get them running again.
If you're unlucky and the VM got corrupted it might be that only destroying and creating it again helps. But that's why you make all modifications via provisioners, don't you? =)
vagrant halt or vagrant suspend won't do nothing in this case, as the VM is not running.
And if the host is just shut down normally, the running VMs should be suspended by recent VirtualBox versions.
If the host suffers from a power loss, the same happens to all the running guests as if they were suddenly powered off.
Data loss can happen, but it depends on the file system mount options, results can vary.
For Linux VMs using ext4 as its main file system, I'd recommend using data=journal instead of the default data=ordered and turn write barriers on by using barrier=1. The above can be done in /etc/fstab. This will help to minimize the possibility of data loss but it is NOT 100% guaranteed.
HTH

Vagrant Best Practice - Persistance

I like how through vagrant I can spin up my machine, configure it and get to coding. However when I do vagrant halt, and then do a vagrant up again, it rebuilds my machine from the base box. All the new stuff I installed, my project repository is gone.
I can see that the virtual machine still exists in virtual box and I can use it from there, but I want to use vagrant to manage it and access it while keep the persistence of the disk as I would accessing it directly from virtual box. My host is windows, my guest is precise64.
Thoughts?
Stephen
Maybe you want to use vagrant suspend? (via)

Resources