Re: nlink



Hello Sergei,

do the following: let nlink show up in MC, then set a (soft) symlink to any regular file: its nlink is incremented by 1. Thus nlink counts all links soft and hard, that's for sure.

Second little experiment: go with MC through some heavily populated directories. You will see that all regular files have a positive nlink, most have just one. It seems very plausible that is the hard link created when a file is created. That means a regular file with just one hard link has only its own entry in the file system, no additional hard links.

For directories, the situation is different. Browsing around with MC you will see that many directories have a nlink value of 2. However, when you create a subdir in them, nlink is incremented by 1. So the rule of thumb would be: a directory (except probably / which is not shown by MC) has a minimum nlink of 2 plus the number of its own first level subdirs. Of course, its nlink goes up if you set your own soft or hard links.

In my opinion, those minimum links for regular files and directories should actually not be counted by MC. MC should deduct them from the count reported by stat.

Regards

frank



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]