[squid-users] Is it safe to resize a rock storage file?

Amos Jeffries squid3 at treenet.co.nz
Mon Oct 16 15:23:13 UTC 2017


On 17/10/17 01:26, duanyao wrote:
> Hi,
> 
> Is it safe to resize a rock storage file as follow (while squid is not 
> running)?
> 
> 1) Increase a rock storage file by increasing the size specified in the 
> configuration file;
> 
> 2) Decrease a rock storage file by decreasing the size specified in the 
> configuration file and run `truncate --size <new size> rock_file`;
> 
> By "safe" I mean no rubbish data will ever be delivered to clients after 
> resizing, while loss of some cached data is OK.

Hell No.

*none* of Squids caches should be manipulated manually. Especially while 
the proxy is running. The UFS based caches are a lot more forgiving of 
file deletion, but that is an artifact of their lazy validation.

rock cache is a single file with more similarities to SQL-type databases 
or a memmap swap file than Squids other cache areas. The -z process for 
rock caches actively formats the file used for data storage into cells 
and blocks. Changing its size manually will definitely lead to some form 
of corruption.

Adding a tool for properly managing these type of changes to caches has 
been on my wishlist for many years now and the design is mostly planned 
out. Please discuss on squid-dev if you are interested in picking up 
that project.

Amos


More information about the squid-users mailing list