Time for action – creating a cache directory
The cache directory location may not be on the same disk or partition. We can mount another disk drive and specify that as the directory for caching. For example, let's say we have another drive connected as /dev/sdb
and one of the partitions is /dev/sdb1
, we can mount it to the /drive/
and use it right away.
$ mkdir /drive/ $ mount /dev/sdb1 /drive/squid_cache/ $ mkdir /drive/squid_cache $ chown squid:squid /drive/squid_cache/
In the previous code, we created a directory /drive/
and mounted /dev/sdb1
, the partition from the other disk drive, to it. Then, we created a directory squid_cache
in the directory /drive/
and changed the ownership of the directory to Squid, so that Squid can have write access to this directory. Now we can use /drive/squid_cache/
as one of the directories with the cache_dir
directive.
What just happened?
We mounted a partition from a different hard disk and assigned the correct ownership to use it as a cache directory...