backup to non-working NFS

zystem

New Member
Feb 5, 2013
19
0
1
vzdump do not check NFS drive before and during backup and do not unlock VMs on drive error
Proposed fixes:
1) Before locking each vm in list check storage free space and storage is writable
2) Stop backup and unlock VM on any backup error
3) Optional. Stop backup of other VMs on storage error
4) After backup was finished check that VMs is not locked
 
As workaround
rename vzdump to vzdump.old
create script in /usr/bin/ named vzdump
Code:
 #!/bin/bash
IN="$@"

function check()
{
timeout 30 ls $STORAGE &>/dev/null
[ $? -ge 1 ] && { echo "ERROR: $STORAGE/ does not exists"; exit 1; }

FREE=$(timeout 30 df -Pk "$STORAGE" | grep -v 'Filesystem' | awk '{print $4}')
[ $FREE -lt 33554432 ] && { echo "ERROR: insufficient space in $STORAGE"; exit 1; }

timeout 30 touch $STORAGE/.dummy
[ $? -ge 1 ] && { echo "ERROR: $STORAGE/.dummy do not writable"; exit 1; }
}

while [[ $# > 0 ]]
do
    case $1 in
        --storage)
            shift
            STORAGE=$1
            ;;
        --exclude)
            shift
            EXCLUDE=$1
            ;;
        --all)
            shift
            ALL=$1
            ;;
    esac
    shift
done
STORAGE="/mnt/pve/$STORAGE"

if [[ "$ALL" == "1" ]]
then
    GREPEXCLUDE=$(echo $EXCLUDE | sed 's/\,/\\|/g')
    [[ "$GREPEXCLUDE" == "" ]] && GREPEXCLUDE='VMID'
    VMLIST=$(qm list | grep -v 'VMID' | awk '{print $1}' | grep -v "$GREPEXCLUDE")
    IN=$(echo "$IN" | sed 's/--all 1//' | sed "s/--exclude $EXCLUDE//" )
else
    VMLIST=$(echo "$IN" | sed 's/--.*$//')
    IN=$(echo "$IN" | grep -o '\-\-.*')
fi
for i in $VMLIST
do
    check
    timeout 28800 vzdump $i $IN
done
 
It would be nice directly from Proxmox. This is an importend thing. We have Nagios to see up coming problems with NFS Storage.
 

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!