Date: Sat, 6 Oct 2001 00:15:33 +0200 From: Erik Trulsson <ertr1013@student.uu.se> To: "Dreamtime.net Inc." <clients@dreamtime.net> Cc: questions@freebsd.org Subject: Re: Directory Limit Question Message-ID: <20011006001533.A75578@student.uu.se> In-Reply-To: <JEELLDECNKBMDHPNMECKOEPADOAA.clients@dreamtime.net> References: <JEELLDECNKBMDHPNMECKOEPADOAA.clients@dreamtime.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 05, 2001 at 02:47:56PM -0700, Dreamtime.net Inc. wrote: > How many subdirectories might be created in a directory on a > local drive (freebsd-4.2). I have put 32765 subdirectories and > when I try to create another one, the system says: > > bash$ ls | wc > 32765 32767 288325 > bash$ mkdir anotherone > mkdir: anotherone: Too many links > bash$ > > Is there is any "official" limit, is there any way to overcome it? You just found the limit and not really. From /usr/include/sys/syslimits.h #define LINK_MAX 32767 /* max file link count */ There can be at most 32767 hard links to any given inode (this is because a signed 16-bit field in teh inode is used to keep track of this.) Since every directory contains a hard link ('..') to its parent and since there are always at least two links to a directory (the directory's link to itelf ('.') and of course the entry in the parent directory this means that the maximum number of subdirectories in a directory is 32767-2 = 32765. Changing this limit to something larger than 16 bits would require rebuilding the filesystem after modifying the kernel appropriately and would almost certainly break lots of things. Changing the counter from signed to unsigned (and changing LINK_MAX to 65535) might work but I wouldn't recommend doing that unless you know what you are doing since the chances are fairly high that something will break. Question: Why would you want to have that many subdirectories ? I can't really think of any compelling reasons. -- <Insert your favourite quote here.> Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011006001533.A75578>