Some help with Squid swap.state please?

  • Hey all, i am having an issue where basically overnight the Hard drive usage on my pfSense box went from 4% usage to 44%..

    I read this: look here: and see that my swap.state file is indeed very large, some 566GB!!

    I would like some assistence with how to do this "Compact swap.state" so it is set to automatically rotate via cron

    It says to add some stuff into the squid configuration but am unsure how or where to do this

    Thanks in advance

  • delete /var/squid/cache/swap.state and restart pfsense

  • Thanks for the reply.. does this affect my cache that is already stored in any way?

    Also would like some kind of way for this to be done automatically as it keeps getting larger and larger

    I just noticed too that i now have my disk usage up to 73%.. there is now a large 566gb file called swap.state and a new one called and that is already like 200gb.. do i have a problem here?? this box has been running caching the same amount of clients for 2 months now and until yesterday had only used 4% of the drive… I need help here

    I deleted the swap.state file and it has gone, but my pfSense still says 73% of drive used..

  • No one can help?

  • If you cache everything for too long, squid decides to mess up the cache (not sure why, but I am investigating it).  The only way to fix it is to shutdown squid and then do a "rm -rt /var/squid/cache".  This may take a while, but it deletes the cache and starts off with a brand new cache once you use "squid -z" to rebuild the cache.  Then set squid to only cache for 30 or 60 days.  I have noticed this problem only when I don't set a limit to cache time and it is left blank.  Squid then runs rampant on the drive and fills it completely.  I think it might have to do with space allocation and the amount of folders.

  • Not meaning to hijack this thread.. in Squid where is the setting to cache for 30 or 60 days? All I can see is Log rotate option.

  • Correction on my last post.  I explained it incorrectly from lack of sleep, sorry  :-\

    The log file takes up the hd if it is not rotated.  It will write everything accessed to that file and it can become very large if not rotated.  The cache time is set up with rotation policy under "Cache Mgmt".  These policies, as I understand it, only kick in when the space is taken up past the defined settings under water-marking (defined as a % of whole allocation on disk)

  • I understood that by 'rotating' or deleting the swap.state file its not actually removing my built up cache from the last couple months?

    I really need that cache working to assist my bandwidth.  I dont know how i can check this, i just see that now after a few days of deleting that file my Disk Space now only shows 1% usage… i should have a fair bit of built up cache from the last 2-3 months.. please help someone!

  • Since you had deleted the cache, you have nothing built up over the last two months.  Since you were having problems, squid needed to be rebuilt from the ground up otherwise the rotation was never going to get corrected.  What do your cache settings look like?  What exactly are you trying to cache?  If you give setup info, we can help tune it to your needs.

  • I didn't delete cache, i just removed that huge swap.state file..

    My /cache folder is 11gb in size, so i guess that hasn't happened in just 2 days (going by lightsquid total bandwidth used since i deleted that file doesnt even add up to 11gb).  I am Caching as much as i can, files up to 1gb for around only 28 people.

  • My server filled up a 160GB drive overnight after enabling squidguard. I've tried "squid -k rotate" thinking it had to be logging but I can't get rid of the swap.state which is one thing I'm looking at. No other files I've found are of any consequential size. Can't restart PFsense since it's in production and I'm looking for a way to get some space back. Can you restart squid and squidguard without restarting the box?

  • you can yes.  I finally set my squid log to rotate every 1 day and my large file problem has gone away.  I removed the large swap.state whilst everything was still running.

    My squid cache all seems to be there so i dont know what is the use of having that swap.state log for any longer time.. I just need cache to help with lack of bandwidth so it seems to work fine.

  • You can also try memory cache, its faster then Disk.
    With a lot of sites setting sessions, squid is not so efficient To handle this.

Log in to reply