Moving Squid Cache to Storage Volumes

If you are using centralized storage and would like to move the cache to that volume for purposes of speed or size then you can perform some quick command line options to enable this support.


In cases where you have a ramdisk, high speed drive such as a high performance SSD, or RAID 0 or RAID 10 array you can move the cache to this volume to increase the performance of the squid cache.


Another reason to move the cache would be to use an large size cache. This will allow you to have the cache on the non-system disk, for example, on ClearBOX.


This simple script should migrate your cache to the storage device. This script is tailored for ClearBOX so please adjust accordingly on non-ClearBOX systems.

service squid stop
mkdir /store/data0/live/server1/squid-cache
echo "/store/data0/live/server1/squid-cache           /var/spool/squid        none bind,rw 0 0" >> /etc/fstab
rsync -av /var/spool/squid/. /store/data0/live/server1/squid-cache
mkdir /tmp/oldsquid
mv /var/spool/squid/* /tmp/oldsquid/
mount /var/spool/squid/
chown squid:squid /var/spool/squid/
service squid start

Test squid to ensure that it is all working on the new location. You can also verify the mount.

mount|grep squid

Once you have confirmed that squid is running, remove the temporary cache directory.

rm -rf /tmp/oldsquid


content/en_us/kb_o_moving_squid_cache_to_storage_volumes.txt · Last modified: 2018/03/01 18:12 by cjones