How to Save 33GB of Disk Space (or... Managing Plesk Backups)

Our hosted server recently ran out of disk space - an awkward situation. A little research revealed that /var/lib contained quite a lot of data - about 33GB more than we were expecting, most of it in /var/lib/psa/dumps/tmp.

Turns out that this is where Plesk puts its temporary files when doing backups, and for some reason they weren't getting removed, and in our case, they totalled 33GB. So... first of all we removed them, and then set about making sure the situation didn't happen again.

Chris Meller notes that sometimes the permissions on the directory get broken (such as when you restore from a backup), so I made sure that it was owner/group psaadm:psaadm and then, just to be sure, added a quick nightly cron job for root that runs the following script to remove any temporary files older than 90 days. Job done.

#!/bin/sh
#
# Delete backup more than 90 days old.
#
backupDir="/var/lib/psa/dumps/tmp"
#
daysToKeep=90

echo "Checking for files older than $daysToKeep days in $backupDir"
listOfFiles=`find $backupDir -mtime +$daysToKeep`
if [ ! -z $listOfFiles ]
then
      echo "Found [$listOfFiles]"
else
      echo "None found."
fi
for toDelete in $listOfFiles
do
      echo "Deleting $toDelete"
      rm -rf $toDelete
done
echo "Done."

This site uses cookies. Continue to use the site as normal if you are happy with this, or read more about cookies and how to manage them.

X