September 24, 20196 yr They are stored inside the libvirt.img file that is mounted at /etc/libvirt. When mounted the full path to the where they are stored is /etc/libvirt/qemu
September 24, 20196 yr Author 1 hour ago, itimpi said: They are stored inside the libvirt.img file that is mounted at /etc/libvirt. When mounted the full path to the where they are stored is /etc/libvirt/qemu Thanks. Is it a way to backup and restore individual xml`s for specific kvm`s?
September 24, 20196 yr @frodr I use the following user script running once a day someone posted here on the forum. Can't find the source right now. It saves the xml and the NVRAM files in a zip file in the path you have to set at the top. Backups older than 30 days gets cleaned out with every run. #!/bin/bash #backs up #change the location below to your backup location backuplocation="/mnt/user/Backup/vm_settings/" # do not alter below this line timestamp=`date '+%Y-%m-%d__%H-%M-%S'` dir="$backuplocation"vm_settings/"$timestamp" # dont change anything below here if [ ! -d $dir ] ; then echo "making folder for todays date $timestamp" # make the directory as it doesnt exist mkdir -vp $dir else echo "As $dir exists continuing." fi echo "Saving vm xml files" rsync -a --no-o /etc/libvirt/qemu/*xml $dir/xml/ echo "Saving ovmf nvram" rsync -a --no-o /etc/libvirt/qemu/nvram/* $dir/nvram/ chmod -R 777 $dir echo "information: creating ZIP-archive and cleaning up old data" zip -r -9 "$backuplocation"vm_settings/"$timestamp".zip "$backuplocation"vm_settings/"$timestamp" && rm -r "$backuplocation"vm_settings/"$timestamp" # Amendmend to the original script of danioj by Deeks 2017 # Delete all backups older than 2 days ONLY if newer files exist # Two remarks for quick and easy testing # 1. Line 148 : Set parameter --> actually_copy_files="0" # 2. Lines 1068 & line 1070 : Use parameter -mmin in stead of -mtime to test with minutes rather than days # Credits for this code to JBRELAND on https://tinyurl.com/ycrrbobv echo "information: cleaning out backups older than 30 days in location ONLY if newer files exist" $backuplocation/ for j in $backuplocation/ do if [[ -n $(find "$j" -type f -mtime -29) ]]; then #echo "debug: valid criteria to enter loop" find "$j" -type f -mtime +30 -exec rm -f {} \; fi #echo "debug: ended if sequence after loop" done sleep 5 exit
September 24, 20196 yr Author 2 hours ago, bastl said: @frodr I use the following user script running once a day someone posted here on the forum. Can't find the source right now. It saves the xml and the NVRAM files in a zip file in the path you have to set at the top. Backups older than 30 days gets cleaned out with every run. #!/bin/bash #backs up #change the location below to your backup location backuplocation="/mnt/user/Backup/vm_settings/" # do not alter below this line timestamp=`date '+%Y-%m-%d__%H-%M-%S'` dir="$backuplocation"vm_settings/"$timestamp" # dont change anything below here if [ ! -d $dir ] ; then echo "making folder for todays date $timestamp" # make the directory as it doesnt exist mkdir -vp $dir else echo "As $dir exists continuing." fi echo "Saving vm xml files" rsync -a --no-o /etc/libvirt/qemu/*xml $dir/xml/ echo "Saving ovmf nvram" rsync -a --no-o /etc/libvirt/qemu/nvram/* $dir/nvram/ chmod -R 777 $dir echo "information: creating ZIP-archive and cleaning up old data" zip -r -9 "$backuplocation"vm_settings/"$timestamp".zip "$backuplocation"vm_settings/"$timestamp" && rm -r "$backuplocation"vm_settings/"$timestamp" # Amendmend to the original script of danioj by Deeks 2017 # Delete all backups older than 2 days ONLY if newer files exist # Two remarks for quick and easy testing # 1. Line 148 : Set parameter --> actually_copy_files="0" # 2. Lines 1068 & line 1070 : Use parameter -mmin in stead of -mtime to test with minutes rather than days # Credits for this code to JBRELAND on https://tinyurl.com/ycrrbobv echo "information: cleaning out backups older than 30 days in location ONLY if newer files exist" $backuplocation/ for j in $backuplocation/ do if [[ -n $(find "$j" -type f -mtime -29) ]]; then #echo "debug: valid criteria to enter loop" find "$j" -type f -mtime +30 -exec rm -f {} \; fi #echo "debug: ended if sequence after loop" done sleep 5 exit Thanks.
Archived
This topic is now archived and is closed to further replies.