Speeding up ClearCase lost+found removals

Have you ever had a lot of unnecessary files in a ClearCase VOB’s lost+found folder? Have you ever tried to get rid of them and the best you can do is the following command from within the lost+found folder? (This is a Windows based command.)

cleartool find . -exec "cleartool rmelem -force \"%CLEARCASE_PN%\""

Try using that multiple times to speed things up and you’ll probably be presented with the heart stopping “cleartool: Error: Database identifier (dbid) not found in database” message? It turns out, this appears to be because the “find” command tries to read files as they are being rmelem’d by the other find command already running. Going at it this way, you’re limited to one mass removal operation at at time…but that’s slow, especially when you’re trying to get rid of 30,000+ files like me (a story for another day).

So what am I doing (at this very moment) to help alleviate this? (The actual command is all on one line. I’ve included the shell prompt for clarity of the working directory. The “delims=?” part is to prevent filenames with spaces from being cut off.)

FOR /F "delims=?" %A IN ('dir <mask> /b') DO cleartool rmelem -force

And it’s working! I’m using things like “a*”, “b*”, etc. for the mask in order to run parallel removals. It may not be the best tactic, but at least I’m watching four command line windows all removing elements from lost+found under the same repository. This will mean four times less waiting for me, and that’s something that (to me) is worth writing about.


This entry was posted in Work and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *