I suppose you could write a small script which moves the files into
correct place.

Each filename is a hexadecimal number. The file belongs in

  L1 = number / L2 / L2
  L2 = (number / L2) % L2

  cache_dir/L1/L2/filenumber

With L2 = 256 the calculation becomes very easy. Each filename can then
be read

  XXL1L2XX

So I suppose the following script would work

#!/bin/sh
find [0-9]* -type f -print |
  sed -e 's%.*/.*/\(..\)\(..\)\(..\)\(..\)%\0 \2/\3/\1\2\3\4%' |
    while read line; do
      mv $line;
    done

Then clean up from the extra L2 directories by running

rm -rf ??/???

Regards
Henrik


Leon wrote:
> 
> Ah ok then :) Thanks for your quick reply!
> 
> Is there a way of moving to the suggested 16/256 structure from what I
> currently have without losing all the currently stored objects?
> 
> Cheers,  Leon
> 
> ----- Original Message -----
> From: "Henrik Nordstrom" <[EMAIL PROTECTED]>
> To: "Leon" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, March 24, 2003 7:44 PM
> Subject: Re: [squid-users] only using one first-level cache directory
> 
> Does look correct to me as you have told Squid to put up to 4194304
> (2048 * 2048) files in each L1 directory.. and as Squid starts with the
> first directory first all your files will be in the first L1 directory..
> 
> With this setting all directories from 00/100 to 1F/7FF will not even
> have a theoretical chance of being used.
> 
> Generally the default L2 parameter of 256 is recommended for all setups
> unless you have very specific reasons to change it (I usually use
> smaller values in testing with a very small cache, but 256 for larger
> caches >200MB). With a L2 parameter of 256 the default L1 parameter of
> 16 is good up to about 7GB of cache IIRC.
> 
> Regards
> Henrik
> 
> m�n 2003-03-24 klockan 18.47 skrev Leon:
> > Hi there!
> >
> > I spotted something rather odd with my squid today. Using the config line
> >
> > cache_dir aufs /usr/local/squid/cache 2048 32 2048
> >
> > with squid-2.5.STABLE1-20030309, my cache directory looks like

Reply via email to