KVM backups

perhaps not simpler, but more generic.
i'm thinking of an automated way to exclude disks with a certain name pattern, that i'm using for caches or generated, expendable data.

let's look at the following kvm-definition:

Code:
name: proxy                                                                                                     
ide2: SAN-NFS-ISO:iso/debian-504-i386-netinst.iso,media=cdrom                                                      
vlan0: virtio=DE:AD:BE:EF:CA:FE
[B]bootdisk: [COLOR=Blue][I]virtio0[/I][/COLOR]
[COLOR=Blue][I]virtio0[/I][/COLOR]: SAN-NFS-Disk:96/vm-96-disk-1.raw
virtio1: SAN-NFS-Disk:96/[COLOR=Red][I]cache[/I][/COLOR]-disk.raw[/B]
ostype: l26
memory: 4096
onboot: 1
sockets: 2
cores: 2
description: proxy, virus filter, ad-blocker
i see two approaches (for virtio):

1) exclude all disks, except the bootdisk.
here we install the operating system on the bootdisk device virtio0.
all additional disks are expendable and can be excluded from backup
basically this can be done in two steps:
a) get virtio0 (or whatever):
Code:
grep '^[COLOR=Blue]bootdisk[/COLOR]' 96.conf.orig |cut -d' ' -f 2
b) filter 96.conf.orig to 96.conf:
Code:
grep -v '^virtio' 96.conf.orig >96.conf
grep '^virtio' 96.conf.orig |grep '^[COLOR=Blue]virtio0[/COLOR]: ' >>96.conf
2) exclude disk pattern (cache):
Code:
grep -v '^virtio.*[COLOR=Red]cache[/COLOR]' 96.conf.orig >96.conf
the hook has to react only on qemu backup jobs ($ENV{VMTYPE})
and creates the .orig copies and does the greps.
afterwards the config is restored and the .orig files are removed.
 

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!