Somewhere I got the idea of using Squid as a package cache instead of approx,
apt-cacher, apt-proxy, etc. (E.g. ) That thread had some of the details
needed, but it is missing some details. E.g. The settings that will allow
the hard drive to spin down.
Squid is running on an old laptop and is only used when the package lists are
updated and package files are downloaded. When these things are not
happening, I wanted the harddrive to spin down. Besides using the
laptop-mode utilities to change the appropriate kernel settings, the
following options were changed in order that the hard drive spin down when
connections are not being made through Squid.
Below are the changes I made to the Debian default configuration for squid
2.7 and the reason for these changes.
# cache_dir ufs /var/spool/squid 5000 1 2
The first number "5000" means cache 5000 MB of http responses. It is
important to have a large cache in order to store package files.
Changing the next two numbers finally allowed the hard drive to spin down for
days at a time. The default setting is 16 256. This creates 16 subdirectories
with 256 subdirectories. These 16*256=4096 subdirectories are used to cache
the http request results (such as the deb packages). I observed Squid
reading something from these directories in a sequential fashion every few
minutes. (It first reads one subdirectory, waits a couple minutes, then reads
another, and so on, over and over again.) Reading of the subdirectories is
enough to keep the hard drive spinning.
Changing the setting so to "1 2" creates 1*2=2 subdirectories. Although
Squid still reads these over and over again, apparently the info is cached in
memory b/c the hard drive no longer spins up.
# access_log syslog:daemon
Not sure this is necessary for the harddrive to spindown: Causes squid to use
syslog (rsyslog) to write to the log file. This might help if rsyslog
buffers the output more than having squid write the log files directly.
# cache_store_log none
Turned off writing to this log. Again, not sure if necessary to allow
harddrive spindown: The laptop-mode settings may buffer file writes enough.
# http_access allow localnet
Uncommented this line to allow computers on local network to connect to
# maximum_object_size 153600 KB
Increase the maximum size of http request reponses so that large debian
packages will be stored is the cache (rather than discarded).
----------end squid changes---------------
One also needs to change apt's configuration file so that apt will use the
Squid computer as a proxy. On each computer add to /etc/apt/apt.conf the
If anyone has improvements please add to this thread. Maybe we can add this
to the Debian wiki?
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org