Difference between revisions of "Alias"

From VSI OpenVMS Wiki
Jump to: navigation, search
(Created page with "An '''alias''' or a '''soft link''' is a File ID that several directory entries point to. It looks like a file but is actually only a link to the real file. ODS-5 volumes supp...")
 
 
Line 1: Line 1:
An '''alias''' or a '''soft link''' is a File ID that several directory entries point to. It looks like a file but is actually only a link to the real file. ODS-5 volumes support [[Hard link|hard links]] that point to the same FID independently and can be deleted independently like files.
+
An '''alias''' is a File ID that several directory entries point to. It looks like a file but is actually only a link to the real file. ODS-5 volumes can support hard links - aliases that point to the same FID independently and can be deleted independently like files without riskingto delete the actual file.
 +
 
 +
=Soft links vs hard links=
 +
A system that uses hard links keeps track of the number of links for each file; a system that does not use hard links displays link counts of 0.
 +
When the original file is deleted by its original name on a system with hard links enabled, the file remains accessible through any of the hard links.
 +
When the original file is deleted by its original name on a system without hard links enabled, the actual file (i.e. header) is deleted and all the aliases turn into dangling directory entries.
 +
 
 +
=Link count=
 +
Link count is displayed with the DIRECTORY/FULL and DIRECTORY/LINK commands. If hard links are enabled on the system, the actual link count is displayed; otherwise 0 is displayed.
  
 
=File systems=
 
=File systems=
Line 5: Line 13:
  
 
=Creating aliases=
 
=Creating aliases=
To create an alias, use SET FILE file_name /ENTER=alias_name. If hard links are enabled on the volume, a hard link will be created; otherwise a soft link will be created
+
To create an alias, use SET FILE file_name /ENTER=alias_name. If hard links are enabled on the volume, a hard link will be created; otherwise a soft link will be created.
  
 
=Deleting aliases=
 
=Deleting aliases=
To remove an alias, use SET FILE file_name /REMOVE=alias_name. After the alias is removed, the file will still be accessible.
+
To delete an alias or the original name of the file, use SET FILE file_name /REMOVE=alias_name. This command enables you to remove one of the names of the file without deleting the file. If you use this command to remove the name of a file that has only one name, you cannot access that file until you use ANALYZE/DISK_STRUCTURE to retrieve it.
If you use DELETE to remove an alias, the command will delete the actual file (i.e. the file header) and consequently all of the directory entries pointing to its header including the original one.
 
If you use DELETE to remove a hard link, the actual file will not be deleted and all of the references to it will remain functional.
 

Latest revision as of 10:42, 3 October 2018

An alias is a File ID that several directory entries point to. It looks like a file but is actually only a link to the real file. ODS-5 volumes can support hard links - aliases that point to the same FID independently and can be deleted independently like files without riskingto delete the actual file.

Soft links vs hard links

A system that uses hard links keeps track of the number of links for each file; a system that does not use hard links displays link counts of 0. When the original file is deleted by its original name on a system with hard links enabled, the file remains accessible through any of the hard links. When the original file is deleted by its original name on a system without hard links enabled, the actual file (i.e. header) is deleted and all the aliases turn into dangling directory entries.

Link count

Link count is displayed with the DIRECTORY/FULL and DIRECTORY/LINK commands. If hard links are enabled on the system, the actual link count is displayed; otherwise 0 is displayed.

File systems

Soft links are supported by ODS-2 and ODS-5; hard links are only supported by ODS-5 systems and need to be enabled to be used.

Creating aliases

To create an alias, use SET FILE file_name /ENTER=alias_name. If hard links are enabled on the volume, a hard link will be created; otherwise a soft link will be created.

Deleting aliases

To delete an alias or the original name of the file, use SET FILE file_name /REMOVE=alias_name. This command enables you to remove one of the names of the file without deleting the file. If you use this command to remove the name of a file that has only one name, you cannot access that file until you use ANALYZE/DISK_STRUCTURE to retrieve it.