Backup to many servers by ProxmoxVE

VGusev2007

Renowned Member
May 24, 2010
114
12
83
Russia
Hi all!


I have two servers.

The first server is: Proxmox-VE. I have more VMs.

The second server is: Backup server. It powered by FreeNAS. It has a large hdd.

The second server is remotly. It lives in a remote server room.

I need to create backup dublicated.

For example:

Step 1:
I want to create a fast backup by backup my VMs to LOCAL hdd mounted to /mnt/backup

Step 2:
I want to copy a backup file from LOCAL hdd /mnt/backup to second server, AFTER step 1 (i.e. by scp or rscp or nfs). And delete old backup on second server.

What do I need for this?

RTFM says me about the file: /etc/cron.d/vzdump

Code:
# Atomatically generated file - do not edit

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

00 02 * * 1,2,3,4,5   root vzdump --quiet --snapshot --storage BACKUP 106
40 02 * * 7           root vzdump --quiet --snapshot --storage BACKUP 101
00 03 * * 1,3,5       root vzdump --quiet --snapshot --storage BACKUP 103
....
and so on

I can edit this file by hand like this:

Code:
# 106
00 02 * * 1,2,3,4,5   root /patch/to/my/custom/script

And create script file like this:

Code:
!#/bin/bash
vzdump --quiet --snapshot --storage BACKUP 106
if ....
then ... backup to remote server ....
....
....
exit 0

I think it is an bad idea and a bad design.

What are you think about my problem?
 
You can use a hook script for that. See

/usr/share/doc/vzdump/examples/hook-script.pl

Thank a lot for you.

I read man pages of vzdump:

HOOK SCRIPT
You can specify a hook script with option "--script". This script is called at various phases
of the backup process, with parameters accordingly set. You can find an example in the
documentation directory ("hook-script.pl").


For use this featches i need to edit:

Code:
/etc/cron.d/vzdump
like this:

Code:
00 02 * * 1,2,3,4,5   root vzdump --quiet --snapshot --storage BACKUP 106 --script /patch/to/script.pl


Will it a good solution?