IBM Support

Identifying hard links within a VOB

Troubleshooting


Problem

This technote explains how to identify IBM® Rational® ClearCase® hard link in a VOB on both Microsoft® Windows® Linux® and UNIX®.

Resolving The Problem









About Hard Links

A VOB hard link (created if you omit the -slink option when running the cleartool ln command) is an additional name for an existing element. Since there is no visible link (as with a symbolic link) a hard link can cause confusion when running a "cleartool ls" command. It is suggested that VOB symbolic links be used instead of VOB hard links whenever possible.


When you check out a VOB hard link (check out one of the hard link names), all the other names for the element are listed as checkedout but removed.

The other names also will not appear in Windows Explorer. The element is checked out, but there are no view-private files associated with the other names. Also, a cleartool dump <file-name> will be identical for either of the names or links that were created. This can also cause confusion.

A hard link points to an inode on UNIX and Linux, or in ClearCase to an element. An explicit ClearCase command to identify hard links is not available; however, it is still possible to use a series of commands to clearly identify ClearCase objects that are hard linked.

How hard links can be identified differs based on operating system.

For UNIX and Linux file systems, you can match the inode of the elements to see if they are the same indicating a hard link. Inodes are data structures that contain information about files on UNIX and Linux file systems. Each file has an inode and is identified by an inode number (i-number) in the file system where it resides. Inodes provide important information on files such as user and group ownership, access mode (read, write, execute permissions) and type.

Windows does not use an inode reference in its file systems and has no real concept of a hard link outside of ClearCase the way UNIX does, so finding hard links on Windows is more difficult.

Below are the methods you can employ to identify hard links in your VOBs.




UNIX and LINUX

ClearCase 7.0 and later:



As of ClearCase 7.0, there is a new way to determine if an element has hard links elsewhere in the VOB.
  • The following command will allow you to see if an element has hard links:
cleartool describe -aliases -all {filename}

Review the ClearCase Command Reference Guide on the topic of describe (cleartool man describe) for more information on the -aliases option.
  • You can also use cleartool find executed as follows from the root of the VOB:

cleartool find -all -exec 'cleartool describe -fmt "%[aliases]ACQp\n" $CLEARCASE_XPN'

This output will provide for you a list of all the elements in the VOB, and if a given element has more than one hardlink, the other hard link will be displayed after a comma in the list.
The output will look similar to the following:

"/vobs/TestVOB1@@/main/dir1/7/1.txt", "/vobs/TestVOB1@@/main/dir1/7/1.foo.txt"

  • Finally, the following command will provide you only the elements with hard links:
cleartool find -all -exec 'cleartool describe -fmt "%[aliases]ACQp\n" $CLEARCASE_XPN' | grep ","


ClearCase 7.0 and prior:

On UNIX and Linux the following are two additional ways to identify ClearCase hard links:

  1. Use the OS command ls -i in the VOB where the files reside. The files listed with identical inode numbers are hard linked.

    Example:

    <view/vob>% ls -i
           49 bar.c              
    42 foo.c
           
    42 bar.f               37 lost+found


    To view hard linked elements by inode, run the following command:

    <view/vob>% cleartool find . -nxn -exec 'ls -id $CLEARCASE_PN'
           34 .
           49 ./bar.c
           
    42 ./bar.f
           42 ./foo.c

           37 ./lost+found

    Same number indicates a hard link.

  2. Use the undocumented dump command to find and match the oid and or dbid on individual files:

    cleartool dump

    Example:

    >cleartool dump foo.c
    foo.c (947820ac.064d43f1.ae62.cc:68:71:d9:5c:2b)
    /view/test_vob/foo.c@@\main\1
    oid=947820ac.064d43f1.ae62.cc:68:71:d9:5c:2b  dbid=12813 (0x320d)
    <...skipped...>

    >
    cleartool dump bar.f
    bar.f (947820ac.064d43f1.ae62.cc:68:71:d9:5c:2b)
    /view/test_vob/bar.f@@\main\1
    oid=947820ac.064d43f1.ae62.cc:68:71:d9:5c:2b  dbid=12813 (0x320d)
    <...skipped...>


    cleartool ls -dump

    Example:

    >cleartool ls -dump foo.c
    ===> name: "foo.c", ino: 0x3209, dir off: 0x5
        rule: 2, state: VOB
        cataloged oid:
    adf9ecfd.a2a34645.8e0d.e6:2b:66:16:df:65 (mtype 5)
        config match oid: 947820ac.064d43f1.ae62.cc:68:71:d9:5c:2b (mtype 8)
    foo.c@@\main\1                           Rule: \main\LATEST


    >cleartool ls -dump bar.f
    ===> name: "bar.f", ino: 0x3209, dir off: 0x3
        rule: 2, state: VOB
        cataloged oid:
    adf9ecfd.a2a34645.8e0d.e6:2b:66:16:df:65 (mtype 5)
        config match oid: 947820ac.064d43f1.ae62.cc:68:71:d9:5c:2b (mtype 8)
    bar.f@@\main\1                           Rule: \main\LATEST


WINDOWS

On Windows the following methods can be used to identify ClearCase hard links:

ClearCase 7.0 and later:


As of ClearCase 7.0, there is a new way to determine if an element has hard links elsewhere in the VOB.
  • The following command will allow you to see if an element has hard links:
cleartool describe -aliases -all {filename}

Review the ClearCase Command Reference Guide on the topic of describe (cleartool man describe) for more information on the -aliases option.
  • You can also use cleartool find executed as follows from the root of the VOB:

cleartool find -all -exec "cleartool describe -fmt \"%[aliases]ACQp\n\" \"%CLEARCASE_XPN%\""

This output will provide for you a list of all the elements in the VOB, and if a given element has more than one hardlink, the other hard link will be displayed after a comma in the list.
The output will look similar to the following:

"\TestVOB1@@\main\BC-DELL-LAP\7\1.txt", "\TestVOB1@@\main\BC-DELL-LAP\7\1.foo.txt"

  • Finally, the following command will provide you only the elements with hard links:

cleartool find -all -exec "cleartool describe -fmt \"%[aliases]ACQp\n\" \"%CLEARCASE_XPN%\"" | findstr ","


ClearCase 7.0 and prior:

Use the undocumented dump command to find and match the oid and or dbid on individual files:

To view hard linked elements by dbid run the following command:

<view/vob>% cleartool find . -nxn -exec "cleartool ls -dump %CLEARCASE_PN%" | findstr ino:
===> name: "file1038.txt", ino: 0xb7a, dir off: 0x30
===> name: "file1039.txt",
ino: 0xb7a, dir off: 0x31
===> name: "file104.txt", ino: 0xb82, dir off: 0x32
===> name: "file1040.txt", ino: 0xb86, dir off: 0x33
===> name: "file1041.txt", ino: 0xb8a, dir off: 0x34

Same ino: number (dbid) indicates a hard link.


[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"VOB","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"2002.05.00;2003.06.00;7.0","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
29 September 2018

UID

swg21118639