Reputation: 2134
I have a project that is deployed on a CentOS6 using vagrant. I am trying to create a different machine with a different name and IP address using vagrant. Despite me changing the name of the box and IP on the Vagrantfile, it says the machine is already up and running.
I also changed the name of the VM1 and did the vagrant up, still it renames my VM1 to its old name and do not create a second VM.
How can I try to create a so called copy of the VM using vagrant?
Upvotes: 1
Views: 1736
Reputation: 53703
When you copy the full vagrant project folder, you also copy a .vagrant
folder, this folder contains the id (and uuid) of the VM.
So after you did a copy, when you run vagrant up
from the new folder, it will still operate the same VM than the original folder.
you just need to remove the .vagrant
folder from the new project folder, vagrant will create a new VM
first, you need to clone your VM, the easiest is to do that from VirtualBox UI, select your original VM and make a clone (integral clone). You can also do a clone from CLI (actually vagrant runs a clonevm command when it creates a new VM from the vagrant box)
Then, you need to check the id of the new VM. You can run from command line
$ VBoxManage list vms
This will list all vms with their associated Id, you can then edit the id file from the .vagrant/machines/default(or machine name)/virtualbox
folder. You can also check the index_uuid
This should do the trick. After you made the edit, if you run vagrant up
again; vagrant will operate the new VM you've just cloned
Upvotes: 6