Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a file that I keep linking to. It's up to 45 links now. Does anyone know how I can find out what the maximum number of hard links is in OS X 10.11 (El Capitan)?

share|improve this question

migrated from serverfault.com Jan 17 at 1:06

This question came from our site for system and network administrators.

up vote 12 down vote accepted

It seems the theoretical limit is about 1 billion hard links on an HFS+ volume.

Indirect node files have a special identifying number called a link reference. The link reference is unique among indirect node files on a given volume. The link reference is not related to catalog node IDs. When a new indirect node file is created, it is assigned a new link reference randomly chosen from the range 100 to 1073741923.

The limit for links to a single file is 4294967295, the maximum number of a UInt32, which is about four times larger than the volume limit, which you'll exhaust first.

linkCount
For indirect node files, this field contains the number of hard links that point at this indirect node file.

As a practical matter, this design is quite strange, and suffers from performance issues. The more hard links you have on a volume, the slower it will be to create a new one, as the system must first find an unused link reference number, then insert it into the metadata directory. Then that metadata directory must be searched to dereference a hard link.

You may begin seeing performance problems with only a few thousand links; your great-grandchildren won't live long enough to create a billion if you start today. In practice you'll notice this most often when managing Time Machine backups, which use hard links extensively.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.