-   Slackware (
-   -   Migrating Squid from NT to Slackware (

Woodsman 09-27-2006 11:33 PM

Migrating Squid from NT to Slackware
Any Squid SMEs here? I hope so!

I have been using Squid on my NT4 box for a long time. Many thanks to the person who supports this porting! Squid definitely helped me with my dialup connection and I intend to keep using Squid to augment my new broadband connection.

I installed squid from a package on All went well.

I want to migrate my squid cache from my NT4 box to my slack box. I copied the files, modified the permissions to nobody and then started squid. Squid started fine but did not like the swap.state file. I'm no expert, but based upon what I can see, squid is ignoring the copied cache because of the swap.state file.

The NT version was built with STABLE10 and this slack version is STABLE13.

Any ideas about convincing the new version to accept the significantly large cache and rebuild the swap.state file, or convert the swap.state file to a format that STABLE13 likes?

I dislike the idea of throwing away this valuable cache. I can observe the impact the cache has on all of my surfing, whether on dialup only several days ago, or even now, with broadband. The idea of rebuilding that cache is discouraging. :)

I appreciate any help and insight!

Alien Bob 09-28-2006 03:17 AM

From the Squid 2 FAQ:


If you remove the swap.state while Squid is not running, you will not lose your entire cache. In this case, Squid will scan all of the cache directories and read each swap file to rebuild the cache. This can take a very long time, so you'll have to be patient.

Woodsman 09-28-2006 01:33 PM

Thanks Eric. :)

I saw that snippet yesterday, but for whatever reason my mind did not absorb the information in a useful manner. A day later, some sleep, and time away from the problem helps me see the text in a different light. That is, my solution is embedded in that text snippet, but yesterday was not intuitively obvious to me. :)

When I copied the cache from NT4 to Slackware, I also copied the swap.state file. In my defense I had no idea the file would be incompatible with the version of squid I installed on Slackware. The snippet above does provide a clue. The solution seems to be 1) copy the cache, 2) do not copy the swap.state file, 3) start squid manually (squid -NCd1) to send output directly to the screen and provide immediate feedback , and 4) wait---as long as necessary for squid to rebuild the cache index (swap.state).

I have a cache that is almost 1 GB in size, so I'll be sure to run the rebuilding process while I am doing something else. However, I am reasonably certain this approach will work. Thanks again!


I'm confused by the squid.conf directive cache_dir.

At my NT4 box, currently I have squid configured with:

cache_dir ufs o:/squid/cache 1024 16 256

My original understanding is that the 1024 (megabytes) refers to the total squid cache size. That is, when squid fills the sublevels to the point of being within 95% of 1024 MB (1 GB) of cached files, squid then will begin the process of deleting least recently used files. But yesterday I ran across a snippet that implied the 1024 number refers to each sublevel. That is, of the 16 sublevels defined above, squid will store 1024 MB of files in each sublevel. Which is correct?

The embedded instructions in squid.conf does not explain this in detail, or I am not reading the text correctly. My reading remains the former interpretation, but if I am wrong and the 1024 refers to each sublevel, then I need to know because I don't have the drive space to store 1024 MB x 16 (16 GB) worth of files. :)


Unlike SquidNT, yesterday I quickly learned that installing squid in GNU/Linux requires me to pay attention to file and directory permissions. After some web surfing, I noticed that some people recommend creating a new user and group account called squid, and assigning the log and cache directories permissions to that user and group. Some people just leave things be and use nobody/nogroup. Anybody here have any insight in the difference and a preference? I understand why squid refuses to run as root. I'm just asking which method people prefer: 1) leave things as is with nobody/nogroup or create squid/squid and modify the squid.conf cache_effective_user and cache_effective_group directives?

Woodsman 09-29-2006 02:17 AM

For curious visitors to this thread, the solution outlined above worked great. The time to rebuild the swap.state file on my older hardware required only 72 seconds for a 800 MB of cached files. Not bad!

All times are GMT -5. The time now is 03:38 AM.