Quantcast
Channel: unorganisiertes sammelsurium (Artikel mit Tag elektronen und bits)
Viewing all articles
Browse latest Browse all 12

VirtualBox - Maschine Klonen

$
0
0

Nur mal kurz zur Erinnerung - einfaches Klonen von Maschinen in Virtualbox, ohne nerviges Geklicke:

#/bin/bash
if [[ -z "$1" ]]; then
        echo "no disk image given"
        exit
fi
if [[ -z "$2" ]]; then
        echo "no name given"
        exit
fi
if [[ -z "$3" ]]; then
        echo "no port given"
        exit
fi

VBoxManage createvm             \
        --name $2               \
        --ostype Debian_64      \
        --register

VBoxManage modifyvm $2          \
        --memory 128            \
        --pae off               \
        --boot1 disk            \
        --boot2 net             \
        --boot3 none            \
        --boot4 none            \
        --nic1 bridged          \
        --cableconnected1 on    \
        --bridgeadapter1 eth0   \
        --mouse ps2             \
        --keyboard ps2          \
        --audio none            \
        --clipboard disabled    \
        --vrdp on               \
        --vrdpport $3           \
        --usb off               \
        --rtcuseutc on

VBoxManage storagectl $2        \
        --name "SATA Controller"\
        --add sata              \
        --controller IntelAhci  \
        --sataportcount 1       


VBoxManage clonehd $1.vdi $2.vdi \
        --format VDI            \
        --type normal           \
        --remember              


VBoxManage storageattach $2     \
        --storagectl "SATA Controller"\
        --port 0                \
        --device 0              \
        --type hdd              \
        --medium "$1.vdi"       \
Vergessen werden darf natürlich nicht, danach maschineneindeutige Merkmale wie zB die Keys des SSH-Servers (rm /etc/ssh/ssh_host_*; dpkg-reconfigure openssh-server) neu zu generieren.


Viewing all articles
Browse latest Browse all 12