Just a quick follow-up to my previous post about using LVM to clone logical volumes to create new VM’s. I’ve written up a quick script to help automate the process which allows you to rapidly deploy a fleet of test VM’s without having to mess about.
The script is attached below and requires PHP. Configure the config options within the script and then to provision a new VM you simply sudo ./makevm.php <vmname> and it will take care of everything.
- Creates the snapshot of the original logical volume
- Sets the permissions on the device so that the user can access it
- Creates the raw VMDK file and registers it with VirtualBox
- Creates the base VM with the name provided
- And finally it configures the VM to use the correct disk and network setting etc
That’s all there is to it
makevm.tar (10.0 KiB, 1,009 hits)