Created
March 18, 2018 14:34
-
-
Save eXtrem0us/1eb7304921d2d5aa4f923a046b47255b to your computer and use it in GitHub Desktop.
Backup your OpenNebula images in one go
This file contains hidden or 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 | |
# | |
# This script backs up your opennebula images to compressed qcow2 in one go. | |
# You may need to login through oneadmin user. | |
# | |
TargetDir="./" | |
for vmimage in $(seq 0 3) | |
do | |
imgname="$(oneimage show $vmimage|grep NAME|cut -d: -f2|tr -d ' ')" | |
imgpath="$(oneimage show $vmimage|grep SOURCE|tr -s ' '|cut -d' ' -f3)" | |
echo "making backup from $imgpath to $imgname.qcow2" | |
qemu-img convert -cpO qcow2 $imgpath "$TargetDir$imgname".qcow2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment