Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a vagrant box running on VirtualBox, and I need to make a copy (with all its existing config and data), so that I can make changes on it without affecting the original.

The problem is that my original box came as a file package - the internet connection where I'm working with is extremely slow so someone else copied their vagrant and virtualbox folders to my machine. Thus there is no

config.vm.box_url

to use.

How can I accomplish this?

Edit: I am using Vagrant 1.2.2

share|improve this question

1 Answer 1

up vote 20 down vote accepted

Create a new box from your existing vm:

  • cd into the directory with your Vagrant file

  • run vagrant package This will export a box file called package.box by default

  • run vagrant box add foo package.box virtualbox to add package.box to your existing boxes. (Assuming you are using virtualbox and not VMWare)

  • run vagrant box list to verify it was added.

Now you can just create a new folder, run vagrant init as normal and set your box to the following:

 config.vm.box = "foo"

The new VM will spin up with the exact data that was present in the previous VM.

Vagrant Documentation


Additionally checkout a new product from the creators of Vagrant called Packer. It will do this same thing, but allow you to copy your vm's to other providers (Amazon, VirtualBox ect..)

share|improve this answer
    
Seems like a great way, but unfortunately I am using a different version of vagrant, while your commands seem to be for 1.0.x –  xiankai Aug 23 '13 at 3:47
    
@xiankai I am running 1.2.2 and I have verified that these steps work for me. I made a few tweaks to my answer for clarity, give it another try and let me know what errors you get. –  spuder Aug 23 '13 at 4:59
    
Ah, after looking at the link you posted, I tried vagrant package instead of vagrant box package and it seems like I'm on the right track now! –  xiankai Aug 23 '13 at 8:36
    
vagrant package is correct. That was a typo on my part. –  spuder Aug 23 '13 at 13:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.