IBM Support

Removing Symbolic and Hard Links in ClearCase

Troubleshooting


Problem

This technote explains how to remove links created by the IBM® Rational® ClearCase® []cleartool ln[] and []cleartool ln -s[] command.

Resolving The Problem

ClearCase links, both hard (cleartool ln) and soft (cleartool ln -s), are treated as VOB elements, so the cleartool rmelem command is used to remove links:

Note: You can use cleartool rmname to preserve the symbolic link, but remove any references to it in latter directory versions, as mentioned in the below output.

Remove Symbolic Link

  1. From the target directory execute cleartool rmelem against a soft link:

    M:\admin_vu\vob1\Folder1\sub_dir2>cleartool ls
    Folder3 --> ../../Folder3

    M:\admin_vu\vob1\Folder1\sub_dir2>cleartool rmelem Folder3

  2. This dialogue will appear, and you must click Yes to proceed with the removal:

    [ClearCase]
    i  CAUTION! This will destroy the symbolic link, and will remove the symbolic link from all directory versions that now contain it. Once you destroy the symbolic link, it will be hard to restore it to its current state. If you want to preserve the symbolic link, but remove references to it from future directory versions, use the "rmname" command. Symbolic link "Folder3" is enter in 1 directory versions.
    Destroy symbolic link?

     [Yes] [No] [Cancel]




Review IBM Rational ClearCase Reference Guide on the topic of rmelem or rmname (cleartool man rmelem | rmname ) for more information.

Remove Hardlink

Locating and removing a VOB hardlink may require the use of a utility, find_hlinks_lstfnd, refer to technote 1200838.



UNIX® and Linux® ONLY

If a link is created using operating system commands, ClearCase will be able to follow and use the link; however, attempts to remove the link using cleartool commands will fail.

Example: You are in a view/VOB context and create a hardlink using the OS command instead of a cleartool command. The following output shows the results from a cleartool ls -long and also shows the results of an attempt to remove the link using the cleartool rmname command.



[j]/vobs/j>ln foo.c ln_foo.c
[j]/vobs/j>cleartool ls -l
version      c.c@@/main/1            Rule: element * /main/LATEST
version      d.c@@/main/1            Rule: element * /main/LATEST
version      foo.c@@/main/1          Rule: element * /main/LATEST
version      ln_foo.c@@/main/1 [view-->vob hard link]     Rule: element * /main/LATEST
directory version   lost+found@@/main/0   Rule: element * /main/LATEST

[j]/vobs/j>cleartool rmname ln_foo.c

cleartool: Error: Unable to remove "ln_foo.c".

[j]/vobs/j>cleartool ls -long
version      c.c@@/main/1            Rule: element * /main/LATEST
version      d.c@@/main/1            Rule: element * /main/LATEST
version      foo.c@@/main/1          Rule: element * /main/LATEST
version      ln_foo.c@@/main/1 [view-->vob hard link]     Rule: element * /main/LATEST
directory version  lost+found@@/main/0    Rule: element * /main/LATEST

You will need to use an operating system command to remove the link if it was created using an operating system command.

[j]/vobs/j>rm ln_foo.c
rm: remove regular file `ln_foo.c'? y

[j]/vobs/j>cleartool ls -long
version      c.c@@/main/1             Rule: element * /main/LATEST
version      d.c@@/main/1             Rule: element * /main/LATEST
version      foo.c@@/main/1           Rule: element * /main/LATEST
directory version  lost+found@@/main/0   Rule: element * /main/LATEST

[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Cleartool","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":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Cleartool","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
29 September 2018

UID

swg21148781