Adding a Cache Dir
by Chris Robertson
Adding a new drive to Squids cache directory set is a useful thing to know. And simple as well.
Squid will handle the changes semi-automatically, but there are still a few operations that need to be kicked off manually.
Assuming your disk is attached, your OS recognizes it and the disk is formatted:
Ensure the cache_effective_user has write capability on the mount point
Add a cache_dir directive to squid.conf referencing the new mount point
- Stop squid
Run squid -z (as root or as the cache_effective_user)
- Start squid
Downtime reduction hack
by AmosJeffries and HenrikNordstrom
NP: this does not apply to large caches as there is no touching of the existing cache_dir anyway.
Ensure the cache_effective_user has write capability on the mount point
Temporarily change squid.conf to use another pid_filename. squid -z will abort early if it discovers another running squid instance
Add a cache_dir directive to squid.conf referencing the new mount point
Temporarily: comment out the existing cache_dir entries
Run squid -z -f ./squid.conf (as root or as the cache_effective_user)
Undo the temporary changes to pid_filename and pre-existing cache_dir
Reconfigure the running squid with squid -k reconfigure
While the -z with existing ufs/aufs/diskd is harmless it's a destructive operation with for example coss cache_dirs so commenting them out is important.
Back to the SquidFaq