Skip to content

Instantly share code, notes, and snippets.

@mkaraki
Created December 4, 2021 14:34
Show Gist options
  • Save mkaraki/d15b5cac05a792e983740df1f881a30f to your computer and use it in GitHub Desktop.
Save mkaraki/d15b5cac05a792e983740df1f881a30f to your computer and use it in GitHub Desktop.
Backup script for maas kvm (virt)
#!/bin/bash
destdir=/mnt/backupstorage
date=$(date +"%Y%m%d")
for f in /var/lib/libvirt/maas-images/* ;do
fn=$(basename -- $f)
dest="$destdir/$date-$fn.qcow2"
echo "$f => $dest"
qemu-img convert -c -f raw -O qcow2 $f $dest
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment