[NTLUG:Discuss] symbolic links

Kenneth Loafman ken at lt.com
Wed Apr 16 11:02:07 CDT 2003


Fred James wrote:
> Eric Schnoebelen wrote:
> 
>> "Darin W. Smith" writes:
>> - As long as it is a *symbolic* link, rm will just remove the link
>> - (don't do that on hard links though, because a hard link is really
>> - the original file)
>>
>>     Actually, even as a hard link, rm(1) will just remove
>> that name for the file.
>>
>>     When the last link to the file is removed, then the file's
>> space is deallocated, and the inode removed.
>>
>>     So, if you have a file with multiple hard links (the
>> space efficent way to do it) the file will remain as long as one
>> hard link exists.
>>
>> -- 
>> Eric Schnoebelen        eric at cirr.com        http://www.cirr.com
>>         Ignorant people in preppy clothes are more dangerous
>>           to America than oil embargos.  -- V. S. Naipaul
>>
>> _______________________________________________
>> https://ntlug.org/mailman/listinfo/discuss
>>
>>
>>  
>>
> My understanding of links - please correct me were I may stray - and a 
> question, please:
> (1) When creating a link, no new file is created.
>     (a) "hardlinkname" is only an alias for the same inode as the 
> original file.
>     (b) "symboliclinkname" (sometimes called "soft link") points to the 
> original inode, and has its own inode.
>     (c) The "space savings" of a hard link is that it has no inode of 
> its own.
> (2) Soft links can remain after the original file is deleted, and 
> therefore point to nothing
>     (b) Can hard links do the same?
> Thanks in advance.
> 

Hard links cannot remain by themselves if the filesystem is operating 
properly.  The hard link is literally another name for the file and 
every operation on the hard link, remove included, is done to the file, 
and to its original directory entry.

...Ken





More information about the Discuss mailing list