Automatic VM Backups

Automate your VM backup process

Backup Configuration

Log on to your proxmox web interface and go to the top level Datacenter->Backup

Add a single backup profile - Select your node, a time (I like Saturday morning at 1) and select a single VM by ID. Set email notification to "On Failure Only" and mode "Snapshot".

And you're done for that machine. The configuration SHOULD default to only save 1 copy at a time, deleting the older backups.

I want more granular control of how many backup files are saved, so after creating a single profile I'll edit the cron jobs manually and specify per vm.

Edit /etc/cron.d/vzdump as show below - adding --maxfiles N as needed. (I want at least 3 versions of my firewall backed up, but only 1 version of the large fileserver). Note that editing the config file manually is not recommended, and proxmox COULD overwrite it, but it has always worked for me. Also note that I have given the larger machines up to an hour to complete their backup before the next backup is scheduled.

# cluster wide vzdump cron schedule
# Automatically generated file - do not edit

PATH="/usr/sbin:/usr/bin:/sbin:/bin"

00 2 * * 6           root vzdump 100 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 3
15 2 * * 6           root vzdump 101 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 3
30 2 * * 6           root vzdump 102 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 2
45 2 * * 6           root vzdump 103 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 2
00 3 * * 6           root vzdump 104 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 2
15 3 * * 6           root vzdump 105 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 2
30 3 * * 6           root vzdump 106 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 2
45 3 * * 6           root vzdump 107 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1
45 4 * * 6           root vzdump 108 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 2
00 5 * * 6           root vzdump 109 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 2
10 5 * * 6           root vzdump 110 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1
20 5 * * 6           root vzdump 112 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1
30 5 * * 6           root vzdump 189 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1
00 6 * * 6           root vzdump 190 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1
15 6 * * 6           root vzdump 191 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1
30 6 * * 6           root vzdump 420 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1
45 6 * * 6           root vzdump 666 --mailto my@email.com --quiet 1 --mode snapshot --storage backups --compress lzo --mailnotification failure --node proxmox --maxfiles 1

After changing the configuration file the webinterface will show the new configuration: