How can I backup and then restore a vagrant box?

498 views
Skip to first unread message

Tim Visher

unread,
Mar 23, 2016, 9:15:49 AM3/23/16
to Vagrant
Hi Everyone,

We have a very lengthy and sadly brittle provisioning process. Making both of those better is on our roadmap but it unfortunately makes people very nervous about recreating their VMs which leads to other problems.

I had the idea that I could make a backup of the box prior to destroying it, then if anything goes wrong with the provision, you can always fall back to the backup.

I don't believe snapshotting can work here because we want to be able to destroy the box and then recreate it (maybe that's problem number 1?).

My initial idea was to do a `VBoxManage clonevm` step prior to destroying the box and then if anything goes wrong clone the vm back into place and allow you to continue on your way.

My first attempt at this did not go well though, and I'm unclear as to why. Vagrant recognized the machine as already provisioned, but the box itself definitely was not provisioned.

How can I do this? Or is there a better way to accomplish what I'm talking about.

Thanks in advance!

--

In Christ,

Timmy V.

http://five.sentenc.es/ -- Spend less time on mail

Alvaro Miranda Aguilera

unread,
Mar 23, 2016, 9:47:16 AM3/23/16
to vagra...@googlegroups.com
Hello,

Vagrant uses Virtualbox uuid to identify boxes.

VBoxManage list vms

So, if you destroy, then will be some manual work.

I think the easiest way is to do a vagrant package , just be sure to delete /etc/udev/rules.d/70-persistent-net.rule or similar file, then shutdown.


Alvaro.


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c2f79ca4-8b29-4037-b035-6fd78301a73c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim Visher

unread,
Mar 23, 2016, 10:31:37 AM3/23/16
to Vagrant
I had thought of that. One problem is that `vagrant package` took about 15 minutes to complete.

The other problem is that I'm unclear how I can 'restore' the results of `vagrant package`. My understanding of said command is that it prepares your box to be distributed, not be reused locally. Do you know how I could accomplish the later?
Reply all
Reply to author
Forward
0 new messages