Re: [squid-users] Cahce problem- should i remove the squid directory ro remove the cache ?

From: Michael Alger <squid_at_mm.quex.org>
Date: Mon, 8 Sep 2008 13:07:24 +0800

On Sun, Sep 07, 2008 at 03:12:27PM -0400, jmaan_at_nits.ac.in wrote:
> I am not an expert in squid. However I have observed that in my
> squid cache (proxy server) used for students to surf the internet
> shows very little space in the /var partition. It is alwayz almost
> 93%. That makes the squid server diffcult to run too at times.
>
> May I know from you all how to resolve this problem permanently ?
>
> Should I delete the squid directory to remove the present cache to
> remove the cache stored in the /var partition. or will it hamper
> my proxy server ?
>
> Do give some pointers ? I have definite;y did my home work but
> then I a new to squid, in no case I would like to re-work in
> installing and re-configuring the squid ?

If I'm understanding correctly, your /var partition is where squid's
cache is stored, and it's fairly full. You want to reduce the size
of squid's cache in order to free up some space.

The easiest way to do this is to delete the existing cache and
create a new one. This does mean you won't have any cache hits for a
while, but hopefully that will be acceptable for you.

Firstly, you'll need to stop squid before deleting its cache; so
you'll probably want to do this out of school hours when the proxy
isn't in use. It will only take a few minutes.

Step 1: determine the squid cache directory, its current size, and
decide what you want its new size to be.

The current settings can be determined by finding the cache_dir line
in your squid.conf. You can have multiple cache_dir lines, but
you've probably only got the one.

It looks something like this:

cache_dir aufs /var/spool/squid 200 16 256

The type might be different, but don't worry about it. The important
parts are a) the path and b) the size, which is the first number
after the path. In my case, "200" (i.e. 200 megabytes). Yours is
probably much larger. The other numbers (16 and 256) are the number
of directories to create under the cache_dir path, but you can
just leave those as is.

Remember where this line is; later we'll change the size to
something smaller. You should now decide what size you want this to
be.

Step 2: stop squid, usually by entering
  service squid stop
or
  /etc/init.d/squid stop

Step 3: delete the cache

If your cache dir is /var/spool/squid, use

  rm -rf /var/spool/squid/*

to delete all the cached files and logs relating to it.

Step 4: update your squid.conf

Update the cache_dir line in your squid.conf to specify the new
maximum size of the cache. You can also place the cache directory on
a different partition if you have more space elsewhere, or add
additional cache_dir lines to have multiple directories on different
devices.

Step 5: recreate the cache directories

Some distributions (like Debian) have an initscript which does this
automatically if required, but there's no harm doing it yourself.
Just run:

  squid -z

as root to create the cache directories.

Step 6: start squid

Start squid using whatever method you used to stop it before;

  service squid start

or

  /etc/init.d/squid start

Then you're done. Squid will start filling up the disc again with
cached objects, but will stop when it reaches the new maximum cache
size.
Received on Mon Sep 08 2008 - 05:07:29 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 08 2008 - 12:00:02 MDT