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

    Some help with Squid swap.state please?

    Scheduled Pinned Locked Moved pfSense Packages
    13 Posts 6 Posters 25.7k 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.
    • L
      luke240778
      last edited by

      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: http://doc.pfsense.org/index.php/Squid_Package_Tuning 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

      1 Reply Last reply Reply Quote 0
      • N
        NegoroX
        last edited by

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

        1 Reply Last reply Reply Quote 0
        • L
          luke240778
          last edited by

          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 swap.state.new 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..

          1 Reply Last reply Reply Quote 0
          • L
            luke240778
            last edited by

            No one can help?

            1 Reply Last reply Reply Quote 0
            • L
              LostInIgnorance
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • A
                asterix
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • L
                  LostInIgnorance
                  last edited by

                  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)

                  1 Reply Last reply Reply Quote 0
                  • L
                    luke240778
                    last edited by

                    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!

                    1 Reply Last reply Reply Quote 0
                    • L
                      LostInIgnorance
                      last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • L
                        luke240778
                        last edited by

                        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.

                        1 Reply Last reply Reply Quote 0
                        • O
                          ochadd
                          last edited by

                          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?

                          1 Reply Last reply Reply Quote 0
                          • L
                            luke240778
                            last edited by

                            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.

                            1 Reply Last reply Reply Quote 0
                            • marcellocM
                              marcelloc
                              last edited by

                              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.

                              Treinamentos de Elite: http://sys-squad.com

                              Help a community developer! ;D

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.