Skip to content

Instantly share code, notes, and snippets.

@oBuTr471b
Created January 9, 2021 18:58
Show Gist options
  • Save oBuTr471b/7d20c936802cf89333ccc387f86fc6cf to your computer and use it in GitHub Desktop.
Save oBuTr471b/7d20c936802cf89333ccc387f86fc6cf to your computer and use it in GitHub Desktop.
# In The Name Of Allah .
# -- --- ---- -- ----- -
# Sun Jan 3 19:56:30 2021
# Written By : zer0err0r .
# ======= == = ========= =
# Backup all VMs [.xml] file .
# First, Create a new folder to put your [.xml] files in :
if [ ! -d ~/xml_files ]; then mkdir ~/xml_files; fi
# Then, Lets do it :
for item in $(virsh --connect qemu:///system list --all | awk '{print $2}' | grep -v Name); do
virsh --connect qemu:///system dumpxml --domain $item > ~/xml_files/${item}.xml
virsh --connect qemu:///system vol-dumpxml --pool my_pool --vol ${item}.qcow2 > ~/xml_files/${item}.qcow2.xml
done
# ===== == ==== ======== =
# Peace Be Up0n Muhammed .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment