About the lost+found directory

Why are IBM® Rational® ClearCase® elements moved to the VOB's lost+found directory and how do I remove them once there?

Answer

Why Elements Are Moved to the VOB lost+found Directory
Removing Objects from lost+found
Determining the UCM component to which an element in lost+found belongs


Why Elements Are Moved to the VOB lost+found Directory

An object will be placed in a VOB's lost+found directory when the parent directory namespace has been removed (in which case there is no longer a context in which to show the object) or altered such that it's contents have no reference in a previous directory version. This can happen under the following circumstances:

1. The object's parent directory element is removed with rmelem and there are no other hardlinks to the object elsewhere in the VOB.

Example:

%>cleartool rmelem dir1
CAUTION! This will destroy the element, all its branches and versions,
including all data, meta-data and history, and will remove the element
from all directory versions that now contain it. Once you destroy the
element, there will be no way to restore it to its current state.
If you want to preserve the element, but remove references to it from
future directory versions, use the "rmname" command.

Element "dir1" has 1 branches, 2 versions, and is entered
in 1 directory versions.
Destroy element? [no] y
cleartool: Warning: Object "foo.c" no longer referenced.
cleartool: Warning: Moving object to vob lost+found directory as "foo.c.986de380d90b479db49316560deba2f2".
Removed element "dir1".

2. The parent directory is checked out, files and/or directories are added, and then the parent directory is unchecked out.

Example:

%>cleartool co -nc dir1
Checked out "dir1" from version "/main/7".

%>cleartool mkelem -ci -nc foo.c
Created element "foo.c" (type "text_file").
Checked in "foo.c" version "/main/1".

%>cleartool unco dir1
cleartool: Warning: Object "foo.c" no longer referenced.
cleartool: Warning: Moving object to vob lost+found directory as
"foo.c.c7592f61ab0b11db83b5000180f96245".
Checkout cancelled for "dir1".

3. The parent directory is checked out, files and/or directories are added, and then the file or directory has its name removed (rmname) before the parent directory is checked in.

Example:

%>cleartool co -nc dir1
Checked out "dir1" from version "/main/7".

%>cleartool mkelem -ci -nc foo.c
Created element "foo.c" (type "text_file").
Checked in "foo.c" version "/main/1".

%>cleartool rmname foo.c
cleartool: Warning: Object "foo.c" no longer referenced.
cleartool: Warning: Moving object to vob lost+found directory as
"foo.c.c7592f61ab0b11db83b5000180f96245".
Removed "foo.c".


When an object is moved to the lost+found root directory its OID (object ID) is appended to the original filename. For example:

Before: foo.c
After: foo.c.282d5d339cba4043905da6ca201e1f3d

If a directory element is moved to lost+found, all of the subdirectories and elements it contains are moved along with it (the directory structure is kept intact). Since these contents are not located in the lost+found root, however, they are not renamed in the manner described above.



Removing Objects from lost+found

Before taking any steps to clean out the VOB's lost+found, please make a backup of the VOB as a safeguard.

There are two possible ways to remove an object from the root of the lost+found:

1. The object can be moved to a new location in the VOB using the cleartool mv command

2. The object can be permanently deleted from the VOB.



# To move the object to a new location, check out the parent directory of the new location and use the cleartool mv command.

Review the IBM Rational ClearCase Command Reference on the topic of mv (cleartool man mv) for more information.

Example:

% pwd
/vobs/myvob/lost+found

% cleartool ls
test.c.f9e4e356252a11d0a41508000993b102@@/main/1 Rule: /main/LATEST

% cleartool checkout -nc /vobs/myvob/src

% cleartool mv test.c.f9e4e356252a11d0a41508000993b102 /vobs/myvob/src/test.c
Moved "test.c.f9e4e356252a11d0a41508000993b102" to "/vobs/myvob /src/test.c".

Note: It is necessary to use the cleartool mv command as described above since performing a copy/paste operation from Windows Explorer or ClearCase Explorer will simply create a view private file and will not move the element.
# To permanently delete the object from the VOB, use the cleartool rmelem command.

CAUTION: READ THE FOLLOWING BEFORE PROCEEDING
Use rmelem carefully when deleting elements or symbolic links from the lost+found directory. While the content of lost+found typically consists of unwanted elements and symbolic links, in some circumstances it can contain elements that are cataloged elsewhere in the VOB (that is, not orphaned) which would be the case when using symbolic or hard links. For this reason, do not run rmelem recursively in lost+found.

If you need to save an element that is currently in lost+found, catalog it in a versioned directory using mv as explained in the previous section.

Review the IBM Rational ClearCase Command Reference on the topic of rmelem (cleartool man rmelem) for more information.

Example:

% pwd
/vobs/myvob/lost+found

% cleartool ls
test.c.f9e4e356252a11d0a41508000993b102@@/main/1 Rule: /main/LATEST

% cleartool rmelem test.c.f9e4e356252a11d0a41508000993b102


CAUTION! This will destroy the element, all its branches and versions, including all data, meta-data and history, and will remove the element from all directory versions that now contain it. Once you destroy the element, there will be no way to restore it to its current state. If you want to preserve the element, but remove references to it from future directory versions, use the "rmname" command.

Element "test.c.f9e4e356252a11d0a41508000993b102" has 1 branches, 2 versions, and is entered in 1 directory versions.
Destroy element? [no] yes
Removed element "test.c.f9e4e356252a11d0a41508000993b102".

Note: If a directory element is deleted from lost+found with rmelem, its contents will be moved to lost+found in the same manner described in the first section above.

When there are checkouts, they must be cancelled before the element can be removed from the lost+found, refer to technote 1259118 for directions.

Use of pattern matching to remove objects from the lost+found directory

The cleartool interactive shell combined with pattern matching can be used to remove multiple elements at once from the lost+found directory of a VOB.

IMPORTANT: Before following these instructions, you should verify the relevance of the files in the lost+found directory. If there is a chance that these files should not be deleted, do not follow these instructions. Review the ClearCase Administrators Guide on the topic of The lost+found Directory for further information.

From within a ClearCase view, cd into the lost+found directory, start the cleartool interactive shell, and issue the rmelem command:

Z:\VOB1\lost+found>cleartool
cleartool> rmelem *.*

CAUTION! This will destroy the element, all its branches and versions, including all data, meta-data and history, and will remove the element from all directory versions that now contain it. Once you destroy the element, there will be no way to restore it to its current state. If you want to preserve the element, but remove references to it from future directory versions, use the "rmname" command.

Element "nameapp.c.e83edfb9dfa042db90b83d4417fdec5c" has 1 branches, 2 versions, and is entered in 1 directory versions.
Destroy element? [no] yes
Removed element "nameapp.c.e83edfb9dfa042db90b83d4417fdec5c".


Note: Use the -force switch to suppress being prompted with "Destroy element?", for example:

cleartool> rmelem -force *.*

Review the ClearCase Command Reference Guide on the topic of rmelem (cleartool man rmelem) for information about rmelem behavior when removing symbolic links.

Deleting multiple Directory Levels

If there are directories stored in the lost+found directory that should be removed during this procedure, you need to run the rmelem command multiple times.

Why?

* After the first iteration, all elements that were in a sub-directory under lost+found get moved to the root of lost+found.
* The subsequent iteration of rmelem will remove the elements that were moved to the root of lost+found.


Back to top

Determining the UCM component to which an element in lost+found belongs

The following procedure can be used to determine where to move elements in situations where there are one or more elements in the lost+found directory within a VOB that contains many UCM components.

Note: The instructions in this procedure are specifically for finding a UCM component root directory and will not identify the exact subdirectory within the component to which the element needs to be moved. Additionally, this procedure will not work in a VOB that is not a UCM Component VOB.


1) Open a command window (Start > Run > type:cmd.exe)


2) Navigate into a view and into the specific VOB's lost+found directory

3) Run "cleartool dump -l @@" For example:

>cleartool dump -l test.txt.3a99f3b26e9d43bb87e48b981708138c@@

test.txt.3a99f3b26e9d43bb87e48b981708138c@@ (3a99f3b2.6e9d43bb.87e4.8b:98:17:08:13:8c)
M:\mra_EclipseTest\ManyComps\lost+found\test.txt.3a99f3b26e9d43bb87e48b981708138c@@
oid=3a99f3b2.6e9d43bb.87e4.8b:98:17:08:13:8c dbid=289 (0x121)
mtype=file element type=9
stored fstat:
ino: 0; type: 2; mode: 0444
usid: NT:S-1-5-21-141845252-1443263951-584457872-1453
gsid: NT:S-1-5-21-141845252-1443263951-584457872-1023
nlink: 1; size: 0
atime: Wed Dec 31 19:00:00 1969
mtime: Wed Sep 24 07:44:00 2008
ctime: Wed Sep 24 07:44:00 2008
returned fstat:
ino: 289; type: 2; mode: 0444
usid: NT:S-1-5-21-141845252-1443263951-584457872-1453
gsid: NT:S-1-5-21-141845252-1443263951-584457872-1023
nlink: 1; size: 0
atime: Wed Sep 24 07:44:00 2008
mtime: Wed Sep 24 07:44:00 2008
ctime: Wed Sep 24 07:44:00 2008
master replica dbid=3
source pool=33 cleartext pool=35
crde=46
branches:
290 \main
292 \main\mra_EclipseTest


4) Find the line in the output that has "crde=" and make a note of the number that appears after the equal sign. In the above example, the number is "46" that we need. This is the identifier for the component root directory element that we will use to find which component to which the element should be moved.

5) Navigate to the root of the VOB.

>dir
Volume in drive M is CCase
Volume Serial Number is 0234-5789

Directory of M:\mra_EclipseTest\ManyComps

08/28/2007 07:13 AM .
09/18/2008 12:03 PM ..
08/28/2007 07:13 AM Comp1
09/24/2008 07:44 AM Comp2
09/24/2008 07:44 AM lost+found
0 File(s) 0 bytes
5 Dir(s) 52,428,800,000 bytes free


6) Run "cleartool dump @@" on one of the component sub-directories. For example:

>cleartool dump -l Comp1@@

Comp1@@ (ebb32a4a.46224a03.b388.40:71:64:7a:1a:7d)
M:\mra_EclipseTest\ManyComps\Comp1@@
oid=ebb32a4a.46224a03.b388.40:71:64:7a:1a:7d dbid=42 (0x2a)
mtype=directory element type=6
stored fstat:
ino: 0; type: 2; mode: 0777
usid: NT:S-1-5-21-141845252-1443263951-584457872-1453
gsid: NT:S-1-5-21-141845252-1443263951-584457872-1023
nlink: 2; size: 0
atime: Wed Dec 31 19:00:00 1969
mtime: Tue Aug 28 07:13:57 2007
ctime: Tue Aug 28 07:13:57 2007
returned fstat:
ino: 42; type: 2; mode: 0777
usid: NT:S-1-5-21-141845252-1443263951-584457872-1453
gsid: NT:S-1-5-21-141845252-1443263951-584457872-1023
nlink: 2; size: 0
atime: Tue Aug 28 07:13:57 2007
mtime: Tue Aug 28 07:13:57 2007
ctime: Tue Aug 28 07:13:57 2007
master replica dbid=3
source pool=33 cleartext pool=35 derived pool=34
crde=42



7) Find the line in the output that has "crde=" and compare to the number from step 4. In this example, the number we find above is "42" and this is not the component directory we seek.

8) Repeat steps 6 and 7 until you find the directory that matches. In the example, the component directory we want is Comp2 with "crde=46".

>cleartool dump -l Comp2@@

Comp2@@ (93ab2857.7fbe4d3b.b564.91:e0:b1:6d:dd:00)
M:\mra_EclipseTest\ManyComps\Comp2@@
oid=93ab2857.7fbe4d3b.b564.91:e0:b1:6d:dd:00 dbid=46 (0x2e)
mtype=directory element type=6
stored fstat:
ino: 0; type: 2; mode: 0777
usid: NT:S-1-5-21-141845252-1443263951-584457872-1453
gsid: NT:S-1-5-21-141845252-1443263951-584457872-1023
nlink: 2; size: 0
atime: Wed Dec 31 19:00:00 1969
mtime: Tue Aug 28 07:13:58 2007
ctime: Tue Aug 28 07:13:58 2007
returned fstat:
ino: 46; type: 2; mode: 0777
usid: NT:S-1-5-21-141845252-1443263951-584457872-1453
gsid: NT:S-1-5-21-141845252-1443263951-584457872-1023
nlink: 2; size: 0
atime: Tue Aug 28 07:13:58 2007
mtime: Tue Aug 28 07:13:58 2007
ctime: Tue Aug 28 07:13:58 2007
master replica dbid=3
source pool=33 cleartext pool=35 derived pool=34
crde=46



9) Move the specific element to any directory within the component directory structure. You must do this from command line and have the destination directory checked out and an activity set.

For example:

>cleartool lsactivity -cact -cview
2008-09-24T07:43:58-04:00 20080924test mabushee "20080924test"

>cleartool checkout -nco Comp2
Checked out "Comp2" from version "\main\mra_EclipseTest\2".
Attached activity:
activity:20080924test@\Projects "20080924test"

>cleartool move "lost+found\test.txt.3a99f3b26e9d43bb87e48b981708138c" Comp2\test.txt
Moved "lost+found\test.txt.3a99f3b26e9d43bb87e48b981708138c" to "Comp2\test.txt".

10) After you complete step 9, checkin your destination directory.

If you have additional elements in the lost+found directory, you must repeat the procedure for each one.

No comments:

Post a Comment