Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Xml file for the kvm stored?

Featured Replies

Where is the xml file for the kvm stored?

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

  • 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?

 

@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

 

  • 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.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.