Created
December 12, 2013 00:59
-
-
Save HoffmannP/7921504 to your computer and use it in GitHub Desktop.
Creating a copy of you harddrives for a virtual machine copy
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/bash | |
## VM Clone ## | |
VM="$1" # "MeinRechner" | |
System="Debian_64" | |
isoFolder="$2" #"/root/VirtualBox VMs/MeinRechner" | |
strgCtl="sata" | |
VBM="/usr/bin/VBoxManage" | |
$VBM createvm --name $VM --ostype $System --register | |
$VBM storagectl $VM --name $strgCtl --add sata | |
i=0; for dev in /dev/sd?; do | |
$VBM internalcommands createrawvmdk -filename $(basename $dev).vmdk -rawdisk $dev | |
$VBM storageattach $VM --storagectl $strgCtl --port $i --type hdd --medium $(basename $dev).vmdk | |
let i=$i+1; | |
done; | |
for iso in $isoFolder/*.iso; do | |
$VBM storageattach $VM --storagectl $strgCtl --port $i --type dvddrive --medium $iso | |
let i=$i+1; | |
done; | |
$VBM modifyvm $VM --memory 2048 | |
$VBM modifyvm $VM --cpus 2 | |
$VBM modifyvm $VM --boot1 dvd | |
$VBM showvminfo $VM | less | |
echo VBoxHeadless -s $VM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment