KVM – backup and restore VM’S

mount -t cifs -o username=xxx //your.ip.adress/backup/directory/

 

Backup your KVM VM

sudo su
virsh list --all
virsh shutdown vm_name
virsh list --all
virsh dumpxml vm_name
virsh domblklist vm_name
/var/lib/libvirt/images/
virsh dumpxml vm_name > /opt/kvm_backup/vm_name.xml
cp /var/lib/libvirt/images/xxxx.qcow2 /opt/kvm_backup

Restore your KVM VM

virsh undefine vm_name
virsh list --all
cd /var/lib/libvirt/images
rm -rf xxxx.qcow2
cp /opt/kvm_backup/wxxx.qcow2 /var/lib/libvirt/images/
virsh define --file  /opt/kvm_backup/vm_name.xml
virsh list --all
virsh start vm_name

 

Source: https://schh.medium.com/backup-and-restore-kvm-vms-21c049e707c1

KVM – backup and restore VM’S