wilas / vbkick

Tool for building and maintaining VirtualBox VMs described as a code in a single definition file.
Other
8 stars 5 forks source link

Creating boxes from snapshots - use clones? #59

Closed gregelin closed 10 years ago

gregelin commented 10 years ago

export to create a vagrant box appears to us the current version of the virtual machine named in the command.

I am assuming behavior is as follows:

Basic of vagrant box generation

wilas commented 10 years ago

1)

2) I don't know how you use vagrant, but I think you miss understand what the vagrant base boxes are for. I hope this help you a bit:

vbkick export myVM creates vagrant base box - myVM.box

Using this file you can add the box to the Vagrant (http://docs.vagrantup.com/v2/cli/box.html):

vagrant box add myBB1 myVM.box
vagrant box add myBB2 myVM.box
vagrant box add myBB3 myVM.box
vagrant box add myBB99 myVM.box

vagrant box list

but I don't see a reason to do this with the same .box file or with the clone (if the clone is the same as original machine), because vagrant can creates multiple machines base on the same base box:

# Vagrantfile
Vagrant.configure("2") do |config|
    config.vm.define :node1 do |node_config|
        vm_name= "node1"
        node_config.vm.box = "myBB1"
        ....
    end
    config.vm.define :node2 do |node_config|
        vm_name= "node2"
        node_config.vm.box = "myBB1"
        ...
    end
end

Summary

A few quotes and links which explain how things in Virtualbox works and how vbkick use them.

snapshot

Useful to: "save a particular state of a virtual machine for later use. At any later time, you can revert to that state, even though you may have changed the VM considerably since then" src: http://www.virtualbox.org/manual/ch01.html#snapshots

NB. I use vbkick snap myVM for tinkering with new things on given OS. First snapshot after kickstarting (kickstarting is slow) and next after achiving any milstones, so that I can easily back with my work if something go wrong - e.g. broken FS. You can specify a snapshot name by vbkick snap myVM freshInstall

clone

Useful to: "experiment with a VM configuration, test different guest OS levels or to simply backup a VM" src: http://www.virtualbox.org/manual/ch01.html#clone

NB. vbkick do a "full clone" of an existing VM, you can specify a clone name or allow vbkick to create a default name: vbkick clone myVM or vbkick clone myVM myVM_super_clone-201406

export

"This command exports one or more virtual machines from VirtualBox into a virtual appliance in OVF format, including copying their virtual disk images to compressed VMDK" src: http://www.virtualbox.org/manual/ch08.html#vboxmanage-export

vbkivk export myVM do VBoxManage export myVM + extra bits needed to package VM to a Vagrant Base Box. Similar to vagrant package --base my-virtual-machine

Vagrant Base Box

Please follow to find general informations about base boxes: https://docs.vagrantup.com/v2/boxes/base.html Please follow to learn about base boxes format: https://docs.vagrantup.com/v2/boxes/format.html Please follow to learn about virtualbox base box: https://docs.vagrantup.com/v2/virtualbox/boxes.html

vbkick help

I know that documentation of vbkick is far from good but these commands may help:

man vbkick
vbkick --help
vbkick clone -h
vbkick snap -h