[squid-users] Backing up squid cache and restoring it

Alex Rousskov rousskov at measurement-factory.com
Thu Jan 17 17:22:46 UTC 2019


On 1/17/19 6:47 AM, Arne-Tobias Rak wrote:

> my goal is to restore a previous cache state in squid 3.x running on
> Ubuntu 16.04.
> 
> So far I have tried to create a copy of the /var/spool/squid and
> /var/log/squid folders.
> When restoring the cache, I first shutdown squid using
> /sudo squid -k shutdown//
> //sudo service squid stop -k
> /and then restore the previously copied folder contents. I then start
> squid again using
> /sudo service squid start./

> Unfortunately, this does not restore the previous cache contents, as the
> spool/squid/swap.state file is modified during squid startup.

Modification of swap.state upon startup is not incompatible with cache
contents preservation.

In a clean shutdown context, the swap.state* files are essentially an
optimization. You may preserve/restore them if you want to speed up
building of the restored cache index OR you can delete them (and Squid
will slowly build a new cache index from scratch). Just do not leave the
newer swap.state* files when trying to restore the old cache.

If you preserve/restore the old swap.state* files, you may need to
preserve their timestamps as well.


If you need further help, please share cache.log entries related to
cache_dir loading and indicate why you think the old cache contents is
not preserved. Sharing your cache_dir configuration may also help.


Cheers,

Alex.


More information about the squid-users mailing list