Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Adding second harddrive howto. for squid

    Scheduled Pinned Locked Moved Hardware
    2 Posts 2 Posters 20.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mohman
      last edited by

      Adding second hard drive to PFSense v1.2.2, very very quick howto.

      Purpose to doing this, is that squid can cache files to it's own drive.
      I have now two 20Gb ide-drives in my system.

      First power off (of course) and install second drive to computer. You shoud
      check that jumpers are ok on both drives, and ide cables are right.  Computer bios must identify both drives ok, before continue.

      Power on computer. Connect to the PFSense from console.
      This is the hardest and trickiest part:
      Now you must format and slice the new drive, using fdisk, and newfs.

      Good how-to is:
      http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-adding.html
      or google how to take new harddisk to use in Freebsd.

      Take the copy of original fstab file "cp /etc/fstab /etc/fstab.backup" in case that something goes wrong.

      then edit the file /etc/fstab  using vi.
      quick usage: edit the file, press esc, and type "w!" +enter, now your changes are saved.

      Here is mine:

      cat /etc/fstab

      Device Mountpoint FStype Options Dump Pass#

      /dev/ad0s1a / ufs rw 1 1
      /dev/ad0s1b none swap sw 0 0
      /dev/ad1a              /cache          ufs    rw              1      1

      as you can see, I've added the last line to fstab, and I'm using just one slice (partition) ad1a. Now my cachedrive is /dev/ad1a and it is mounted to /cache

      ad1a comes from atadrive (ad/ide) / slavedisk (1)/ slice a.
      Masterdisk is ad0s?

      type:
      #mount -a

      when everything is doing right now, you should see:

      df -h

      Filesystem    Size    Used  Avail Capacity  Mounted on
      /dev/ad0s1a    18G    732M    16G    4%    /
      devfs          1.0K    1.0K      0B  100%    /dev
      /dev/md0      3.6M    38K    3.3M    1%    /var/run
      /dev/ad1a      18G    3.6G    13G    21%    /cache
      devfs          1.0K    1.0K      0B  100%    /var/dhcpd/dev

      …or whatever your disks are.

      check
      #ls /cache

      Now, time to edit squid, go to webconfigurator, and go to squid tab. (services/proxy server/cache management) !!At this point you should have package "squid" added to PFSense.
      Edit the line "Hard disk cache location" and type /cache
      and "Hard disk cache size" to what ever you want, mine is 4000 (4Gb of 20Gb disk)
      Also edit and modify other setting you like.

      Now you should have working squid cache in it's own drive.

      You must also delete /var/squid/cache/*
      and restart squid to take effect new configuration.
      I'm sure I missing something here...but these instructions mainly are, how I got working second drive.

      You can monitor your cache size with command
      #du -h /cache
      or
      #df -h

      ps. I wish that somebody make ataidle and smartd packages to PFSense.

      –Mik@

      1 Reply Last reply Reply Quote 0
      • C
        chudy
        last edited by

        for some kind of fail over or improper shutdown other drive need to be scanned and mount.
        If cache0 is the cache_dir /cache0
        you need to edit also the squid.sh

        #!/bin/sh
        # This file was automatically generated
        # by the pfSense service handler.
        rc_start() {
        if [ -z "`ps auxw | grep "[s]quid -D"|awk '{print $2}'`" ];then
                if [ ! -d "/cache0/00" ];then
                        if [ -z "`ps auxw | grep "fsck_ufs -y /cache0"`" ];then
                        fsck -y /cache0
                        fi
                mount -a
                fi
                /usr/local/sbin/squid -D
        fi
        
        }
        
        rc_stop() {
                /usr/local/sbin/squid -k shutdown
        # Just to be sure...
        sleep 5
        killall -9 squid 2>/dev/null
        killall pinger 2>/dev/null
        
        }
        
        case $1 in
                start)
                        rc_start
                        ;;
                stop)
                        rc_stop
                        ;;
                restart)
                        rc_stop
                        rc_start
                        ;;
        esac
        
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.