h1

Building a separate partition for Squid Cache

June 1, 2006

1. During Linux Install you can create a partition dedicated to your squid cache. Just make a partition as /cache, like you make /boot, and allot your /cache partition any size suited to ur needs(example 15 GB) and format it as etx3 filesystem.

2. After your installation is complete… and you have installed squid from sources or binaries or added it during install….. just change the cache_dir tag to:

cache_dir ufs /cache 15000 35 256
or

cache_dir ufs /cache 10000 22 256 (in case your /cache is 10 GB)

NOTE:***** Ofcourse there is no magical formula about 35 or 22… formulas may change from person to person… I used my own formula… i dont want to write all these to mess it up… if u wanna know that too.. i will give it to u*****

Also dont forget to set permission for squid user to have access to /cache partition.
[root@linuxgossip ~]#chown squid:squid /cache
Here squid is the squid user name under group squid.
Remember the tags,
cache_effective_user squid
cache_effective_group squid

Thats it…. Further it is said that converting your /cache partition to reiserfs improves cache performance.
To do so….Checking for reiserfs installation
##############################
To check if u have reiserfs installed…. try this command at ur shell prompt
[root@linuxgossip ~] mkrei
(and give a tab or hit the tab key…here [root@linuxgossip ~] is the shell prompt)
If ur tab auto-completes mkreiserfs…then…you have reiserfs conversion facility installed..and can convert any of your filesystem or partition to reiserfs.
*** Alternative way to check for reiserfs support
[root@linuxgossip ~]# modprobe -l | grep reiserfs

What if u dont have reiserfs installed
########################
Dont panic….. installing reiserfs is quite easy
Check reiserfs-utils rpm at rpmfind.net
http://rpmfind.net/linux/rpm2html/search.php?query=reiserfs-utils&submit=Search+…
Or,
ftp://rpmfind.net/linux/fedora/core/2/i386/os/Fedora/RPMS/reiserfs-utils-3.6.13-1.i386.rpm

[root@linuxgossip ~]# rpm -ivh reiserfs-utils-3.6.13-1.i386.rpm

check where your cache partion is in the filesystem
#################################
[root@linuxgossip ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hdc2 9.7G 8.8G 409M 96% /
/dev/hdc1 788M 23M 725M 4% /boot
none 125M 0 25M 0% /dev/shm
/dev/hdc6 3.9G 1.8G 1.9G 49% /home
/dev/hdc8 487M 11M 51M 3% /tmp
/dev/hdc5 4.9G 3.0G 1.6G 66% /usr/local
/dev/hdc7 2.0G 480M 1.4G 26% /var
/dev/hdc3 15G 1.5G 14G 10% /cache

******

To convert say cache partition in this example (whose filesystem is /dev/hdc3)…. issue the command from/being root
[root@linuxgossip ~]umount /cache
[root@linuxgossip ~]mkreiserfs /dev/hdc3

Add the following line to /etc/fstab
######################
/dev/hdc3<tab meaning space>/cache <tab> reiserfs<tab>notail,noatime<tab>00
[root@linuxgossip ~] mount /cache

Note:- Your cache location and filesystem or partition may be different from the above example … so make sure u double-check your filesystem location, partition name etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: