Storing index files in a tree

I store my index files on an archive file system.  The current version
of that software does not handle large directories well (fixed in the
next release, of course :-).  Some of my index directories contained
several thousand files and all index operations (amtrmidx, dumper,
amrecover/amindexd) as well as normal Unix commands were very, very slow.

This patch changes the index directory from a flat namespace to one
that matches the text formatted database structure:


With this, I only have roughly "tapecycle" files in any one directory.

This change has significantly reduced my amdump time (amtrmidx went
from taking hours to minutes) and the load on the archive server.
Amrecover is much zippier at startup.

I've also included the ksh script I used for converting an my existing
flat index directories to the new structure.  As the comments mention,
you'll want to change the chown/chmod calls to match your local Amanda
user/group and ownership conventions, and you may need to change the
mkdir if your system does not support the -p option (which creates a
tree no matter how many pieces are missing and does not whine about
already existing components).

To apply my patch, you will first have to apply this patch from Alexandre:

new patch location
It fixes a problem with false matches on the host name in amindexd. My patch accomplishes the same thing in a different way. Since this directory structure matches the text format database, you could make "indexdir" and "infofile" the same and mix the two if that's convenient for your configuration. John R. Jackson, Technical Software Specialist,