Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!aux.support.apple.com!winders From: winders@aux.support.apple.com (Scott Winders) Newsgroups: comp.sys.mac.system Subject: Re: Is there a limit on the number of files? Message-ID: <52739@apple.Apple.COM> Date: 11 May 91 01:20:35 GMT References: <10173@castle.ed.ac.uk> Sender: nntp@Apple.COM Organization: Apple Computer, Inc. Lines: 40 In article <10173@castle.ed.ac.uk> crs@castle.ed.ac.uk (C R Smart) writes: > Is there a limit to the number of files which the mac can handle? I > have been warned that "funny things" happen when the number of files > tops about 700. I am a bit concerned as I have about 800 files at the > moment. > > Is there a limit? Was there a limit? If there is a limit, how to > increase it? The following is true for System Software 6.0.x and System 7: It is sometimes noted that HFS is limited to 64,000 files per volume. This is not strictly correct, though it may be true in practice. A count of the total number of files and directories on the volume is maintained, as a LongInt, in the MDB (block 2). Directory IDs are also LongInts. This limits the number of files and folders on the volume to 2^32-1 (roughly 4.3 billion). That many folders could be created as long as there's room on the volume to hold the expanding catalog B*-Tree. Because each file occupies at least one allocation block, all of at most 65,536 allocation blocks (also numbered by Integers) will be allocated just before that many files are written on the volume, so the limit of 64,000 files will turn out to be close to the practical limit. There is another limitation imposed: a directory's valence is an Integer, and, furthermore, on GetCatInfo requests, any negative number in the ioFlIndex field is interpreted as a request for information on the directory itself. So, while HFS allows the creation of up to 65,536 files in each directory, all of which can be accessed by name, only 32,767 can be enumerated -- a real limitation on folder contents. In practice, the user's patience will run out well before this many items can be enumerated. Finally, all computations on file sizes are performed using LongInts, so there's no practical limit on the size of an individual file -- though the actual limit is about two gigabytes. Scott Winders internet: winders@aux.support.apple.com AppleLink: winders.s@applelink.apple.com