Proxmox VE differential backups

Proxmox VE is a complete virtualization management solution for servers. You can virtualize even the most demanding application workloads running on Linux and Windows Servers. Checkout their page: proxmox.com

Due to lack of better backup functionality I prepared patches to support differential backups in Proxmox VE. These patches are in use for over a year.

What are differential backups?

According to Wikipedia:

A differential backup is a type of data backup that preserves data saving only the difference in the data since the last full backup. (…) Another advantage, at least as compared to the incremental backup method of data backup, is that at data restoration time, at most two backup media are ever needed to restore all the data. This simplifies data restores as well as increases the likelihood of shortening data restoration time.

What my patches do?

My patches extends vzdump, xdelta3 and Web-GUI support. And yes, these patches fully support OpenVZ and KVM.

System administrator can use one additional parameter in Backup Jobs (Datacenter –> Backup –> Add/Edit) the Full Backup Every:

  • By default this value is set to 0. Which simply means: use old behavior (always create full backups).
  • But if you specify value larger than 0, for example 7. It will instruct the vzdump to create full backup once a week and use differentials for the rest.

Please consider the following example:

    vzdump 101 --remove 0 --mode snapshot --compress lzo --storage local --node hvm --fullbackup 4

It will create full backup of VM101 every 4 days, compressed using lzo, stored on local storage.

How to install?

There are three files:

    c760d7481beae8dba3c62f1d95c6fbde  pve-2.2-diff-backup-addon
    42c1a0f34eca9ac23de83523db00f6c5  pve-2.3-diff-backup-addon
    1292670afa84914aac4ebda59d2a7122  pve-3.0-diff-backup-addon
    cd68c203bb1804105a3b4acd52382f6d  pve-3.1-diff-backup-addon
    67fb4d2b397759fb83066ae93cc07b78  pve-3.2-diff-backup-addon

The installation procedure is fairly simple:

  1. Logged as root download:

    For PVE 2.2 (deprecated):

    wget http://ayufan.eu/projects/proxmox-ve-differential-backups/pve-2.2-diff-backup-addon
    

    For PVE 2.3 (deprecated):

    wget http://ayufan.eu/projects/proxmox-ve-differential-backups/pve-2.3-diff-backup-addon
    

    For PVE 3.0 (deprecated):

    wget http://ayufan.eu/projects/proxmox-ve-differential-backups/pve-3.0-diff-backup-addon
    

    For PVE 3.1 (deprecated):

    wget http://ayufan.eu/projects/proxmox-ve-differential-backups/pve-3.1-diff-backup-addon
    

    For PVE 3.2 (current):

    wget http://ayufan.eu/projects/proxmox-ve-differential-backups/pve-3.2-diff-backup-addon
    
  2. Execute bash script. The script contains all needed patches:

    bash pve-3.2-diff-backup-addon apply
    
  3. When everything went right, you’ll see:

    Proxmox VE 3.2 - differential backup support  
    Kamil Trzcinski, http://ayufan.eu/, [email protected]
    
    PATCHED: /usr/share/pve-manager/  
    PATCHED: /usr/share/perl5/PVE/
    
    Restarting PVE API Proxy Server: pveproxy. 
    Restarting PVE Daemon: pvedaemon.
    
  4. Download and install xdelta3. If you want to use LZOP compressor, you have to download my xdelta3 compilation.

    wget http://ayufan.eu/projects/proxmox-ve-differential-backups/pve-xdelta3_3.0.6-1_amd64.deb  
    dpkg -i pve-xdelta3_3.0.6-1_amd64.deb
    

    However, if you paranoid about installing untrusted applications you can compile the package yourself. All the sources can be found here: pve-xdelta3-master.tar.bz2

    Previous release of xdelta was 3.0.5. Please update to the newer one: 3.0.6.

And what about uninstall?

The procedure is simpler than installation. Type in the bash:

    bash pve-3.2-diff-backup-addon revert

After a while, you’ll see:

    Proxmox VE 3.2 - differential backup support  
    Kamil Trzcinski, http://ayufan.eu/, [email protected]

    RESTORED: /usr/share/pve-manager/  
    RESTORED: /usr/share/perl5/PVE/

    Restarting PVE API Proxy Server: pveproxy.
    Restarting PVE Daemon: pvedaemon.

What about UPGRADE? (READ THIS)

This is important part. If you will ever want to upgrade your Proxmox installation (by apt-get dist-upgrade or apt-get upgrade) ALWAYS revert/uninstall patches. You will still be able to apply them afterwards.

How to apply new patch version?

  • Use previous patch to revert changes.
  • Download new patch version and apply as described before.

The results

The results are really astonishing! These are real word values:

    VM   full      diff 1day   diff 2days   diff 3days    diff 4days
    1.   39.10GB   41MB        47MB         51MB          55MB
    2.   96.84GB   1.07GB      1.38GB       1.43GB        1.68GB
    3.   83.95GB   1.68GB      2.66GB       3.69GB        4.25GB
    4.   9.19GB    76KB        76KB         166MB         198MB

You see the differences. The diff sizes strictly depends on the use of the VMs. Using differential backups I have backups from last month (full backup once a week, differential daily)

Why this is not upstream?

I tried to push the changes upstream. They were rejected by Dietmar:

We removed that feature 3 years ago. I have no plans to re-add that. We want to keep vzdump a simple tool.

But I thought that it would be really shame if I wouldn’t go public with this.

Is it stable?

Yes, it is. This extensions uses xdelta3 as differential backup tool, which proven to be well tested and stable. I use it for about 9 months on 4 different Proxmox based servers. No problems so far.

However, if you happen to be paranoidal about backups… You should consider running following script. The script simply tries to verify all differential backups. I recently updated the script to support new VMA archive. So now you can verify backups all supported backups.

    wget http://ayufan.eu/projects/proxmox-ve-differential-backups/pve-verify-backups
    chmod +x pve-verify-backups
    ./pve-verify-backups <backup-dir>

Changelog

  • v1: initial public release with support for PVE2.2 and PVE2.3 (2013-03-05)
  • v2: improved kvm backup size and speed for PVE2.3 (2013-03-08)
  • v3: added support for PVE3.0 (2013-06-02)
  • v3’: updated pve-verify-backups to support VMA archives (2013-06-06)
  • v3’‘: updated patches to support PVE3.1 (2013-08-24)
  • v3’‘: updated xdelta3 to 3.0.6. More info about changes: http://xdelta.org/ (2013-08-24)
  • v3’‘: updated patches to support PVE3.2 (2014-03-15)

Detailed list of changes

  1. pve-xdelta3:
  2. vzdump:
    • added “fullbackup” option
  3. qmrestore and vzrestore:
    • added support for differential backups
  4. PVE.dc.BackupEdit:
    • added controls for maxfiles and fullbackup

Comments