pfSense - Adding a Disk for Squid Cache

Jake G April 02, 2022 #pfSense #SysAdmin

I needed to add a disk to pfSense to be used exclusively for Squid, this is how I did it.

First find your drive you intend to use, you should look for the fields that indicates the size and serial number of your drive.

geom disk list

Next completely wipe out the filesystem on that drive and create a new partition and filesystem, of= is the path of the device, the device name listed by geom should exist in the /dev directory.

dd if=/dev/zero of=/dev/ada1 bs=512 count=1

gpart create -s GPT ada1
gpart add -t freebsd-ufs -a 1M ada1
gpart show ada1

newfs -U /dev/ada1p1

Next we will create a directory for our squid data:

mkdir /media/squid

Finally we will install nano and use it to edit the /etc/fstab file to mount this on boot.

pkg install nano

nano /etc/fstab

Notice below we have failok, this allows the system to boot even if it is unable to mount this location, I suggest having this in place until everything is working, otherwise if something goes wrong you may have to boot into a recover shell to alter the fstab file before your system will boot, I simply leave failok in place because squid is not mission critical, but the system properly booting is.

/dev/ada1p1     /media/squid    ufs     failok,rw      2       2

You can either reboot and allow fstab to mount the location, or you can mount it manually now:

mount /media/squid