Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.

ClearCase Support: How to Clean, Recover, and Defragment ClearCase Views

ClearCase Views are basically your private workspace to access and make changes to VOBs, however these Views quickly decrease in performance as they grow in size. Additionally, ClearCase Views break often. Therefore, Views need to be periodically cleaned, fixed, and even defragmented.

Here are a set of instructions to help with Views. You can actually pick and choose which steps to follow, since most of these steps are optional if your View is still in working condition. You will need to be logged in as the View's owner for all of the instructions to work, and maybe even in your View.

  1. First, I recommend checking in or unchecking out all elements (files and directories) that are checkedout in your View. I do not recommend having elements checkedout for over a week. You can run these procedures to find all of your checkedout elements.
  2. Second, you can clean up all View private elements in your View. You can run this command to find all View private elements in your View.

    cleartool lspriv

    Copy all View private files that you want to keep out of your View and/or permanently add them to source control. Next, make sure you have no checkedout elements, using the instructions in the first step above. Finally, delete all the remaining View private elements with this command. Please note that this command will delete your checkedout elements too, so be very careful with this command.

    cleartool lspriv | xargs rm -rf

    Now, you should have an empty View.
  3. Next, sometimes VOBs are deleted, moved, or renamed. However, Views still think they have View private files in the old VOB location that no longer exists. So, run this command to find these lost files.

    cleartool lspriv | grep "DIR-"

    If any output is produced, then you need to remove this lost View private data files from these obsolete VOB directories.

    cleartool recoverview -force -dir DIRECTORY_NUMBER -tag VIEW_NAME

    The directory number is the information between "". Alternatively, if the same missing VOB has a lot of missing directory data, you can use the "-vob VOB_NAME" arguments, but make sure this VOB Name does not exist elsewhere as if the VOB was just moved.
  4. Next, go to the View's storage directory. Then go to the source sub-directory called ".s". Then go the View's lost and found sub-directory called "lost+found". Delete all files and directories in this lost and found directory. Do not delete this lost and found directory!

    rm –rf VIEW_STORAGE_DIRECTORY/.s/lost+found/*

  5. Now that you have cleaned your View, you now need to clean up the data tables with the follow command. This should drastically improve the speed of large Views that had a lot of cleaning.

    cleartool recoverview -force -tag VIEW_NAME

    This command may take a long time to run. After this command finishes running, immediately run the same command a second time. If a lot of data tables were cleaned up, then the second time that you run this command will defragment or recover internal disk space of the View. In other words, make the data tables smaller without large data gaps. This should improve performance of the View even more.
  6. Finally, force a View refresh on all servers using this command.

    cleartool setcs -current

Your ClearCase View should now be much smaller and faster after you have finished cleaning, recovering, and defragmenting it.

by Phil for Humanity
on 12/12/2008

Related Articles
 » ClearCase Support: How to Reformat or Defragment a ClearCase VOB
 » ClearCase Support: How to Delete a View in ClearCase
 » ClearCase Support: How to Find Checked Out Elements