24.7 Viewing Hard Links for a File

You can view a report of hard links for a file to identify its primary link and the hard link that becomes the primary link if the primary link is deleted. The nss /ListHardLinks command returns a list of all hard links for a specified file, where the first link in the list is the primary link. The second link is the most recently created hard link. All other hard links follow in reverse chronological order of their create time. All links for the file are listed in the order that they appear in the metadata, which is also the order in which a new primary name would be assigned.

IMPORTANT:If the primary link is deleted, the most recently created hard link (the second link reported in the list) becomes the new primary link. Changing the primary link can impact the trustees and inheritance for the file. For more information, see Section 24.1.4, Hard Links and File System Trustees.

The list of hard links contains the following information for the file:

List of Hard Links

Information

Line 1 of the report

The ZID (file number) of the inode that contains the metadata for the hard link file set and the number of links associated with that inode.

Line 2 of the report

The complete name of the primary link, including the path and filename

Line 3 of the report

The complete name of the most recently created hard link name, including the path and filename. This is the next candidate in line to become the primary link if the primary link is deleted.

Lines 4 through 65,536 (up to 65,535 links per file) of the report

The complete name of each of the hard link names, including the path and filename, are listed in the reverse chronological order of their creation time.

To view information about the primary link and hard links for a file on an NSS volume:

  1. Open a terminal console, then log in as the root user.

  2. At the terminal console prompt, enter the following to open the NSS Console:

    nsscon
    
  3. At the nsscon prompt, enter

    /nss /ListHardLinks=vol:path\filename.ext
    

    Replace path with the file’s primary link path or one of its hard link paths where you want to start the search. Replace filename.ext with the actual filename of the file, including the extension.