Last active
January 3, 2019 00:18
-
-
Save contato318/19c3580ccb77cabc37fc0dc7184dd13c to your computer and use it in GitHub Desktop.
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 | |
lista-vms () { | |
echo "###############################" | |
echo "VMS existentes: " | |
VBoxManage list vms | |
echo "" | |
} | |
lista-discos () { | |
echo "###############################" | |
echo "Insira os Servidores que serao migrados: " | |
read SERVIDORES | |
echo "" | |
echo "###############################" | |
echo "Nome dos discos: " | |
for i in $(echo $SERVIDORES | tr -s '|' '\n' | sed '/^$/d') | |
do | |
DISCOS=`VBoxManage showvminfo $i | egrep -i "vmdk|vdi" | awk {' print $5'} | cut -d/ -f3` | |
echo "$DISCOS" | |
DISCO_PATH=`VBoxManage showvminfo $i | egrep -i "vmdk|vdi" | awk '{print $4,$5}'` | |
echo "Caminho: $DISCO_PATH" | |
done | |
echo "" | |
} | |
convertendo-discos-kvm () { | |
echo "###############################" | |
echo "Iniciando convercao dos discos para kvm: " | |
for i in $(echo $DISCOS) | |
do | |
echo "$i" | |
VBoxManage clonehd "$DISCO_PATH" /tmp/disk.raw | |
#VBoxManage clonehd disk.vdi disk.raw --format raw | |
done | |
} | |
lista-vms | |
lista-discos | |
convertendo-discos-kvm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment