[CentOS] hardlinks

Fri Jul 17 10:14:08 UTC 2020
J Martin Rushton <martinrushton56 at btinternet.com>

On 17/07/2020 10:30, Alessandro Baggi wrote:
> Il 17/07/20 10:54, Karl Vogel ha scritto:
>> It depends on the size of the variables in the structure used by the
>> stat() call.  In ext4, the "links" variable is an unsigned 16-bit 
>> integer,
>> so you have your limit of 64k or so.  I've worked with systems where
>> the limit was a signed 16-bit integer, so it maxed out at 32k.
>> XFS may be a full 32-bit integer, so your test script could be running
>> for quite some time.  Or it may just allocate space as it needs.  It 
>> sounds
>> like you have plenty of room for links, so I wouldn't worry.
>> -- 
>> Karl Vogel / vogelke at pobox.com / I don't speak for the USAF or my company
>> Don't accept your dog's admiration as
>> conclusive evidence that you are wonderful.             --Ann Landers
> Hi Karl,
> thank you for your clarification. I will try to rearch this limit (by 
> curiosity)
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos

Have a look at 

On page 105 the inode structure is given:

__uint16_t	di_onlink;
__uint32_t	di_nlink

Page 107 gives more detail:

In v1 inodes, this specifies the number of links to the inode from 
directories. When the number exceeds 65535,the inode is converted to v2 
and the link count is stored in di_nlink.

Specifies the number of links to the inode from directories. This is 
maintained for both inode versions for current versions of XFS. Prior to 
v2 inodes, this field was part of di_pad.

So, the effect is that whatever version you start with, adding more than 
65535 links will force it to version 2 and give you up to 4,294,967,295 

J Martin Rushton MBCS