Hello there, and first of all, thanks to Stephane for his great work !!
I recently came to run a whole bunch of VMs over differents cluster of servers using Incus, and faced a little problem regarding how to automate backups. I mean, simply enough, to be troubleshooted by anyone, even me !!
I went up with this little script, that lets me backup one entire cluster member, to another, automatically.
#!/bin/bash
#to save an entire server, first, export list of instances :
incus list location=$1 -c n -f csv > savetodo.txt
#then define the date format to use in file generated-name, and the path to the list file generated above:
bkpdate=`date "+%Y%m%d"`
input="./savetodo.txt"
#Finally, do the things !
while read -r line
do
incus export $line $line.$bkpdate.bkp.xz
done < "$input"
One can run this script on each servers, with the next-server name as argument, for exemple :
./save.sh <next-membername>
I use XZ compression for backups, but as compressor isnโt really fast, i set backup compression settings as follow, for our 2*12core cpu servers, no-one can barely notice when itโs backuping :
backups.compression_algorithm=xz -8 -T8
One have to notice, that backup is ran in two steps :
1 - The server hosting the VM/CT performs the backup, and compress the datas.
2 - When the tarball is complete, itโs sent to the server where backup are ran.
3 - When upload is complete, the backup process resumes to the next VM/CT
Hope it helps
Best regards,
Joen