Skip to content

Instantly share code, notes, and snippets.

@eXtrem0us
Created March 18, 2018 14:34
Show Gist options
  • Save eXtrem0us/1eb7304921d2d5aa4f923a046b47255b to your computer and use it in GitHub Desktop.
Save eXtrem0us/1eb7304921d2d5aa4f923a046b47255b to your computer and use it in GitHub Desktop.
Backup your OpenNebula images in one go
#!/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