Re: [squid-users] Clearing the cache

From: Henrik Nordström <henrik@dont-contact.us>
Date: Mon, 25 Feb 2008 03:08:16 +0100

sön 2008-02-24 klockan 02:46 -0800 skrev Ric:
> In http://wiki.squid-cache.org/SquidFaq/ClearingTheCache, it says to
> purge the cache via:
>
> squid -k shutdown
> rm -r /squid/cache/*
> squid -z
> squid
>
> I've seen elsewhere say to use:
>
> squid -k shutdown
> echo '' > /squid/cache/swap.state
> squid
>
> I like this second one -- it's fast and simple (and less scary than a
> recursive rm with fumbling fingers). Any problems with it?

My preferred method is

cd /squid/cache
mkdir junk
squid -k shutdown
[wait for it to stop]
mv * junk
squid -z
squid
rm -rf junk

Pro/con
+ almost instant
+ disk space reclaimed quickly
+ No / or * in the dangerous rm -rf line
- some more commands to type
- silly warning about not being able to move junk into junk..
- Temporarily a high I/O load while removing the old files.

to avoid the warning you can use the following mv command

  mv swap.state* ?? junk

Or if the cache is on it's own partition, umount it, newfs and mount it
again.

Regards
Henrik

Received on Sun Feb 24 2008 - 19:12:33 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:05 MST