Created
August 8, 2012 06:16
-
-
Save ligfx/3292736 to your computer and use it in GitHub Desktop.
VirtualBox multi-attach
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
>>> time ( up vm1; up vm2; ) | |
Virtual machine 'vm1' is created and registered. | |
UUID: 66e775d6-8c91-4cf1-8c20-742687f22399 | |
Settings file: '/Users/michaelmaltese/VirtualBox VMs/vm1/vm1.vbox' | |
Waiting for VM "vm1" to power on... | |
VM "vm1" has been successfully started. | |
Virtual machine 'vm2' is created and registered. | |
UUID: 8e073076-94ef-42b4-b64f-56f1ac836d6c | |
Settings file: '/Users/michaelmaltese/VirtualBox VMs/vm2/vm2.vbox' | |
Waiting for VM "vm2" to power on... | |
VM "vm2" has been successfully started. | |
real 0m11.312s | |
user 0m0.329s | |
sys 0m0.192s |
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
function connect_hdd() { | |
local vm="$1" | |
local disk="$2" | |
if test -z "$(VBoxManage list hdds | grep ${disk}$)"; then | |
local attachopts="--mtype multiattach" | |
fi | |
VBoxManage storagectl $name --name sata1 --add sata | |
VBoxManage storageattach $vm --storagectl sata1 --port 0 --device 0 --type hdd --medium $disk $attachopts | |
} | |
function up() { | |
local name="$1" | |
VBoxManage createvm --name $name --ostype Ubuntu_64 --register | |
VBoxManage modifyvm $name --nic1 nat --natdnspassdomain1 on | |
VBoxManage modifyvm $name --memory 386 | |
connect_hdd $name base.vmdk | |
VBoxManage startvm $name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment