Created
December 16, 2010 14:01
-
-
Save stucchio/743418 to your computer and use it in GitHub Desktop.
Clone a Virtualbox VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
old=$1 | |
new=$2 | |
if [ $old ] && [ $new ] | |
then | |
echo "Cloning $old, saving result as $new" | |
else | |
echo "Usage: clone-ubuntu.sh oldname newname" | |
fi | |
VBoxManage clonehd $old.vdi $new.vdi --remember | |
echo Hard drive cloned from $old.vdi to $new.vdi | |
VBoxManage createvm --name $new --ostype Ubuntu --register | |
echo New VM $new created. | |
VBoxManage storagectl $new --name "IDE Controller" --add ide | |
VBoxManage storageattach $new --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium $new.vdi | |
echo Storaged medium attached. | |
VBoxManage modifyvm $new --nic1 bridged --bridgeadapter1 re0 | |
echo Networking turned on. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment