OpenBSD Squid RAM-disk

From WTFwiki
Jump to navigation Jump to search


One can hope that setting up your squid cache_dir in memory would be quicker, so, here's how it's done on OpenBSD 4.4:


 swap /mfs mfs rw,nodev,nosuid,-s=2096900 0 0

'2096900' is roughly 991MB, with 512 byte sector size..
Strange limitation (MAXDSIZ) per platform, my platform is (unfortunately) i386, so thats all I get.


 if [ -x /usr/local/sbin/squid ]; then
       if [ "$(/sbin/mount | /usr/bin/grep '^mfs.*/mfs')" ]; then
               if [ ! -d /mfs/cache ]; then
                       /bin/mkdir -p /mfs/cache
                       /sbin/chown _squid:_squid /mfs/cache
               /usr/local/sbin/squid -z
               echo -n ' squid'; /usr/local/sbin/squid

This will, under the right conditions (squid being there and executable, and /mfs being mounted properly) setup the cache
directory and start squid.