Plesk backup temporary file filling disk

It appears that the Plesk backup utility (pleskbackup Linux) writes to a temporary file prior to moving it to the final destination you’ve specified on the command line.

ie. When running:

/usr/local/psa/bin/pleskbackup all /mnt/nfsshare/pleskbackup.bak

Plesk writes the whole backup file to the local disk in /var/lib/psa/dumps/tmp/:

# ls -lah /var/lib/psa/dumps/tmp/
total 1.9G
drwx—— 2 psaadm psaadm 4.0K 2009-02-09 18:38 .
drwxr-xr-x 3 psaadm psaadm 4.0K 2009-02-09 10:17 ..
-rw-r–r– 1 root   root   1.9G 2009-02-09 18:44 fileTFzx5u

This is a problem when you’re low on disk space on the machine and you’re mounting a NFS drive to backup to… it obviously fills the disk quickly and the backup fails.

Note:

  • Restoration of the backup files created by the script below has not yet been tested
  • Disk may still fill up due to very large site… may have to symlink the psa tmp directory onto the NFS mount
  • Tested with psabackup from Plesk version 8.2.1
  • It turned out that the site used over 60% of available disk space so filled the disk every time.  Plus, Plesk backup/restore on Linux has known issues for site backup files larger than 2GB in size.  Will have to write a manual backup script to overcome this.

The script looked like below, but, will need to be updated to backup sites too large for pleskbackup to handle.  This may or may not work for you depending on the Plesk version you are using… use at own risk.

#!/bin/bash

dopleskbu () {
MYSQLPASS=`cat /etc/psa/.psa.shadow`
for DOMAIN in `mysql -Ns -uadmin -p$MYSQLPASS -Dpsa -e “select name from domains”`;
do /usr/local/psa/bin/pleskbackup domains $DOMAIN –exclude=DOMAIN_IF_YOU_WANT $FPATH.$DOMAIN.bak;
if [ $? == 0 ]; then
logger “$0 $DOMAIN backup complete”
else
logger “$0 $DOMAIN backup error”
fi
done;
}

FILENAME=pleskbackup.weekly
DIR=/mnt/backup
FPATH=$DIR/$FILENAME

# Main calls

dopleskbu
### END OF SCRIPT ###