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

Posted by | October 22, 2009 | Advice and Troubleshooting | 4 Comments

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.

# Delete backup more than 90 days old.

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


  • Nice tutorial Chris! Thanks for sharing this. My server was having the same issues and driving me crazy.

    I’ve added your script to my server root (is there a more appropriate place for it?) and am wondering how to initiate the daily cron? Should I setup the cron under a domain in Plesk? Or is there a better way?


  • Avatar for Chris Lilley Alexander Garzon says:

    Really cool.

    BTW, in news Plesk versions the path is


    Thanks for this useful script !

  • Avatar for Chris Lilley Ivan Vučica says:

    Looks like this might delete folders that do contain newer backups, but themselves aren’t modified! For example, the entire /var/lib/psa/dumps!

    I’m passing additional “-type f” argument to find.

    listOfFiles=`find $backupDir -mtime +$daysToKeep -type f`

    Also, I’ve removed -rf to avoid even accidentally deleting entire folders. Just in case.

  • Thanks Chris I have the same problem so this is really helpful.

    I’ll post back if it works for me.

Leave a Reply

Your email address will not be published.

Get in touch to see how Black Pepper can help your business Contact Us
Download our free whitepaper
In this white paper, we discuss how to apply the techniques and business processes of small Internet start-up companies to large corporate IT projects for maximum success.