Re: [squid-users] Squid Cache Dir Running Out of Space

From: Chris Robertson <crobertson@dont-contact.us>
Date: Wed, 27 Dec 2006 10:54:21 -0900

Ed Lafferty wrote:
> I am running Squid Version 2.6.STABLE5 on CentOS 4.2. Squid is
> configured with two cache directories /asc/array1/squid/var/cache and
> /asc/array2/squid/var/cache. Logs are configured to write to the
> default location /usr/local/squid/var/logs. Here are snippets of
> squid.conf:
>
> #Default:
> # cache_dir ufs /usr/local/squid/var/cache 100 16 256
> cache_dir ufs /asc/array1/squid/var/cache/ 600000 16 256
> #cache_dir ufs /asc/array2/squid/var/cache/ 600000 16 256
> #cache_dir ufs /asc/array3/squid/var/cache/ 600000 16 256
>

Unless this is a typo, you are allocating 600000MB (~586GB) to each
cache dir. That would pretty well explain your problem. As an aside, I
would advise using "aufs" instead of "ufs", assuming you build squid
with the proper support.

> --the 600000 was 800000. I decreased the value and ran #/squid -z to
> try and resize the cache. I did not see any change.
> ...
> # To log the request via syslog specify a filepath of "syslog"
> access_log /usr/local/squid/var/logs/access.log combined
> ...
> #Default:
> cache_log /usr/local/squid/var/logs/cache.log
> ...
> #Default:
> cache_store_log /usr/local/squid/var/logs/store.log
> ...
>
> Squid has shut down with the following error:
>
> 2006/12/27 11:27:04| Rebuilding storage in /asc/array1/squid/var/cache/
> (DIRTY)
> 2006/12/27 11:27:04| diskHandleWrite: FD 12: disk write error: (28) No
> space left on device
> FATAL: Write failure -- check your disk space and cache.log
> Squid Cache (Version 2.6.STABLE5): Terminated abnormally.
> CPU Usage: 0.017 seconds = 0.012 user + 0.005 sys
> Maximum Resident Size: 0 KB
> Page faults with physical i/o: 0
>
> Here is the space left on the server:
>
> Filesystem Size Used Avail Use% Mounted on
> /dev/mapper/VolGroup00-LogVol00
> 90G 12G 74G 14% /
> /dev/hda1 99M 12M 82M 13% /boot
> none 1014M 0 1014M 0% /dev/shm
> /dev/sda1 101G 89G 7.4G 93% /asc/array1
> /dev/sdb1 101G 96G 0 100% /asc/array2
> /dev/sdc1 101G 93M 96G 1% /asc/array3
>
> In order to get Squid working again, I have shut down /asc/array2 as a
> cache drive. However, this leaves me with 7.4GB available on the other
> cache drive and I am afraid it will run out of space quickly.
>
> So, two questions, why am I running out of space. Are there other logs
> going to the cache drives that I don't know about?

Question asked and answered.

> Second, can I shrink
> the size of the cache? Other than taking down Squid for a few moments,
> will it do anything else bad?

That's three questions so far, but who's counting. :) First set your
cache dir size to something more reasonable (80000 would be fine, 70000
might be better) and start squid. It's possible that it's not going to
be happy, as the cache_swap_log is stored by default in the base of the
cache directory, and there is no room to write it, but it's worth a
shot. If it still fails, either remove the contents of one of the sub
directories (rm -f /asc/array2/squid/var/cache/00/00/* for example) and
restart squid, or clear the whole partition and run "squid -z" again to
rebuild the directory structure.

> How bad would it be if I were to
> completely wipe out the cache directories and rebuild them from scratch?
>

You'd loose what information you have cached. Like starting out with a
new server. The only directory where this is even a remote necessity
would be array2.

>
> Thanks in advance for any help you can give.
>
> Sincerely,
> Ed Lafferty
> Mgr, Network Operations
> Bolt Inc.
> http://www.bolt.com
>

Chris
Received on Wed Dec 27 2006 - 12:54:32 MST

This archive was generated by hypermail pre-2.1.9 : Mon Jan 01 2007 - 12:00:01 MST