Created
December 3, 2015 18:07
-
-
Save genofire/009062c6865b6fc968e9 to your computer and use it in GitHub Desktop.
libvirt Backup VMs
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
echo "Cleanup old backup" | |
rm /srv/virt/backup/mail.qcow2 | |
rm /srv/virt/backup/mail.ram | |
rm /srv/virt/backup/mail.xml | |
echo "Start for Backup" | |
virsh domblklist mail | |
virsh dumpxml > /srv/virt/backup/mail.xml | |
virsh snapshot-create-as --domain mail backup --no-metadata --diskspec vda,file=/srv/virt/backup/mail.qcow2 --memspec file=/srv/virt/backup/mail.ram,snapshot=external --atomic | |
virsh domblklist mail | |
# Copy /srv/virt/backup/mail.ram | |
# Copy /srv/virt/backup/mail.xml | |
# Copy /srv/virt/mail.qcow2 | |
# ^-- without backup - the real vm-vda (there is the snapshot writing) | |
echo "End of Backup" | |
virsh blockcommit mail vda --active --verbose --pivot | |
virsh domblklist mail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment