Backup of pve config files

taich

Member
Aug 15, 2020
110
15
23
64
Since I could not find a way to backup most important pve config files, I made this little script.
It creates a tar file of most important config files and sends the file to an email address.
May be someone can use.

Bash:
#!/bin/bash
#
apt install mutt
#
RECIPIENT=user@example.com
THISHOST=$(hostname -f)
TARFILE=${THISHOST}.tar

if [ -f /etc/network/interfaces ]; then
   tar -cf ${TARFILE} /etc/network/interfaces
fi
if [ -f /etc/sysctl.conf ]; then
   tar -rf ${TARFILE} /etc/sysctl.conf
fi
if [ -f /etc/vzdump.conf ]; then
   tar -rf ${TARFILE} /etc/vzdump.conf
fi
if [ -f /etc/fstab ]; then
   tar -rf ${TARFILE} /etc/fstab
fi
if [ -f /etc/pve/vzdump.cron ]; then
   tar -rf ${TARFILE} /etc/pve/vzdump.cron
fi
if [ -f /etc/pve/user.cfg ]; then
   tar -rf ${TARFILE} /etc/pve/user.cfg
fi
if [ -f /etc/pve/storage.cfg ]; then
   tar -rf ${TARFILE} /etc/pve/storage.cfg
fi
if [ -f /etc/pve/firewall/cluster.fw ]; then
   tar -rf ${TARFILE} /etc/pve/firewall/cluster.fw
fi

echo "tar backup from ${THISHOST}" | mutt -s "${TARFILE}" "${RECIPIENT}" -a ${TARFILE}
rm ${TARFILE}
 
And in case you got a PBS running you can also use the proxmox-backup-client to backup those files to your PBS instead of manually tarring and sending them per mail. PBS stores them deduplicated and nothing needs to be stored twice, so I just backup the whole /etc folder every week to my PBS.
 
Last edited:
Sad to see configuration backups are STILL not included in the gui. This just made my day 10times more harder. Can reconfigure a complete cluster because of this bullshit. Wish i had the script beforehand.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!