1

I am working with vagrant 1.7.4, which i use together with lxc 1.1.5 on ubuntu 15.10.

I was working with it the last few weeks and never did vagrant halt before shutting down my computer. Now it happened to me today that my vagrant box was corrupted and it got newly created. In this process it deleted my whole database of course. I have two questions:

  1. Is it right, that vagrant or lxc does not react with a gracefull shutdown when getting a SIGTERM signal from ubuntu when I shut it down? And because of that vagrant boxes can get corrupted? I get this idea because a co-worker told me that this could happen and because of this and this

  2. Is it possible to change the default behaviour of vagrant up, so instead of just creating a new container and overwriting the old one, when it doesn't find a right box. It informs the user and waits for user input. So I could stop vagrant up and do a sql dump before creatinx the box new? This question is probably a change request for vagrant, but I guess there is an easy workaround which I don't know?

1 Answer 1

0

I'm not sure about stopping 'vagrant up' and doing an sql dump, but working upstream of this may solve your problem. Use vagrant with best practice to avoid corruption to begin with, then you should be golden (in terms of future practice). Always run 'vagrant halt' or 'vagrant suspend' prior to shutting your machine down. If you want a safeguard to ensure your vagrant boxes get suspended prior to shutdown (incase you forget to halt or suspend) follow this guide: https://www.ollegustafsson.com/en/vagrant-suspend-resume/

To my knowledge, once a box is corrupted, you have to destroy it and rebuild it. I've had to deal with corrupted boxes before and it is a PAIN because you lose your database(s). You can also do an sql import on a provisioned vagrant up, so that you're pulling sql from an external database. This explains how to do that: https://discourse.roots.io/t/import-database-from-mysql-dump-on-vagrant-up/5514/3

Good luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .