Clear Squid Cache CentOS 5.x

How: service squid stop rm…

Login

Blog History

How:
service squid stop
rm -rf /var/spool/squid/* (removes cached files and directory structure)
rm -rf /var/log/squid/* (removes the logs)
squid -z (recreates the cache_dir structure)
service squid start

Why:
Doing the above can be helpful if you want to claw back some diskspace in a hurry.

If you wanted to shift the squid cache_dir you could edit squid.conf cache_dir to repoint it to another disk/partition before restarting.

2 Comments

  1. Leon

    use mv for shorter down time

    service squid stop
    mv /var/spool/squid /var/spool/squidold
    mv /var/log/squid/* /var/spool/squidold
    squid -z
    service squid start
    rm -rf /var/spool/squidold

    Reply
  2. Leon

    If your disk is full, the squid -z will fail

    you can start the rm -rf for a few, then kill it, go back to squid -z, then complete rm -rf later

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.