cyrus rehash script: from basic to full hashing scheme

Gary Mills mills at cc.umanitoba.ca
Mon Nov 13 16:06:08 EST 2006


On Mon, Nov 06, 2006 at 08:08:59PM +0000, wdspublic at safebrowse.com wrote:
> I work at a college where we have about 4500 student mail accounts. Our 
> Xserve (Tiger 10.4.7) is bound to Active Directory where we're using the 
> student id # as the username which always begins with a 0 or 1. This causes 
> the basic hashing scheme to put the /var/imap/___ files in subfolder "q" of 
> the respective directory (user, quota, ...). We are not using virtual 
> domains. I would like to rehash to the full hashing scheme using the rehash 
> script (/usr/bin/cyrus/tools/rehash). I'm neither a bash nor perl expert, 
> but it appears the rehash script is not compatible with case INsensitive 
> file systems (like our Mac OS Extended - Journaled).

The rehash script depends on lower case directory names being
different from upper case names.  During the conversion, both have to
coexist in the IMAP directories.  Since both hash schemes use
single-letter directory names, the script would be unable to determine
if the conversion had already been done.

> I've made some changes 
> to the script's move_users subprocedure to create new dirs beginning with 
> "." (so it wouldn't remove valid dirs) and then after hashing rename all 
> those "." dirs back to their corresponding letters--just like the 
> move_quotas and move_sieve subprocedures do.

Be careful of leading dots as some directories may already exist with
that type of name.  I'd pick something else instead.  You will
certainly require some intermediate form on a case-insensitive
filesystem.  Even then, it's not possible to determine the current
hash scheme by examining the directory names.  Be careful!

> I'm hesitant to run my changes 
> since there is no easy undo if it doesn't work. (Yes, I know I need a test 
> box.) If any are interested in seeing my modified rehash script, let me 
> know. (I've also added a bunch of print statements for debugging.)

You can test it almost anywhere by giving it a fake imapd.conf file
and a set of directories with the correct hash scheme.

> Also, I haven't found much documentation on the rehash script. I know I'm 
> supposed to
> 1. stop mail services 
> 
> 2. add the following to my imapd.conf
> 	fulldirhash: yes
> 	hashimapspool: yes  # optional 
> 
> 3. run sudo -u cyrusimap /usr/bin/cyrus/tools/rehash full 

That's about it.

> Am I supposed to run anything else (like reconstruct) afterwards before I 
> start up mail services again? 

No, that shouldn't be necessary.

-- 
-Gary Mills-    -Unix Support-    -U of M Academic Computing and Networking-


More information about the Info-cyrus mailing list