[comp.sys.mac.system] Is there a limit on the number of files?

crs@castle.ed.ac.uk (C R Smart) (05/10/91)

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?

-------------------------------------------------------------------------------
Colin Smart         |      Do not meddle in the affairs of Wizards
crs@castle.ed.ac.uk |      for they are subtle and quick to anger. -- Tolkien
-------------------------------------------------------------------------------

winders@aux.support.apple.com (Scott Winders) (05/11/91)

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

glenn@gla-aux.uucp (Glenn L. Austin) (05/11/91)

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?

Boy, then am I in trouble!  I've got close to 1800 files on my disk! ;-)

Seriously -- the main problem is with the Desktop file.  It has an upper limit to
the number of resources it can handle.  This problem disappears with System 7.

===============================================================================
| Glenn L. Austin                | "Turn too soon, run out of room.           |
| Macintosh Wizard and           |    Turn too late, much better fate."       |
| Auto Racing Driver             |   -- Jim Russell Racing School Instructors |
|-----------------------------------------------------------------------------|
| Usenet:  glenn@gla-aux.uucp         | CI$:       76354,1434                 |
| GENie:     G.AUSTIN3                | AOnline:   GAustin                    |
===============================================================================

bitting-douglas@cs.yale.edu (Douglas Bitting) (05/13/91)

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?

I wouldn't think that there is a limit (I sure hope not as I have 1600+ files
on my Hard Drive and it is only 1/2 full).  It would seem that the desktop
file(s) would just continue to grow to hold information as the the number of
files you have grows.  There is no hardware limitation... to the computer, the
disk is just a series of blocks and the controller takes care of accessing
them... the desktop file just tells the controller where to look to get part x
of file y.

>-------------------------------------------------------------------------------
>Colin Smart         |      Do not meddle in the affairs of Wizards
>crs@castle.ed.ac.uk |      for they are subtle and quick to anger. -- Tolkien
>-------------------------------------------------------------------------------

--Doug

-- 
Doug Bitting             | "And we know that in all things God works
PO Box 3043 Yale Station |  for the good of those who love him..."
New Haven, CT 06520      |                       --Romans 8:28
bitting@cs.yale.edu      +------------------------------------------

v109lptc@ubvmsd.cc.buffalo.edu (Mark R Waldmiller) (05/13/91)

>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?
> 
>I wouldn't think that there is a limit (I sure hope not as I have 1600+ files
>on my Hard Drive and it is only 1/2 full).  It would seem that the desktop
>file(s) would just continue to grow to hold information as the the number of
>files you have grows.  There is no hardware limitation... to the computer, the
>disk is just a series of blocks and the controller takes care of accessing
>them... the desktop file just tells the controller where to look to get part x
>of file y.

Actually there is a limit.  It arises because the desktop file for the Finder
has its information stored as resources, and there is a limit to the number of
resources any given file can contain without the system crashing.  The limit
on the number of resources is given in one of Apple's tech notes, I can't
remember the exact value but it is approximately 2700.
Since every file on your disk has a few resources the finder uses (such as
its icon, size information, and other such stuff), the actual number of files
you can have on a given volume is about 700 or so.
There are a few solutions to this problem.  First, rebuilding the desktop
file frequently will eliminate unneeded resources and also will improve 
performance.  Note that doing this will loose any text entered in the "Get
Info" box.  Second, you can partition your hard drive into smaller volumes.
I'd recommend 30-40meg volumes.  Third, and last, and I think best, you can
use a file apple distributes with its appleshare disks called Desktop Manager.
After placing this file in your system folder, the Mac will create two invisible
files on the disk for tracking the desktop.  These files do not contain
resources, so you do not run into the problem that the desktop file has.
You should be able to get a copy of the Desktop Manager from an apple dealer
or by asking around.  (If you can't get hold of it any other way, you can
ask me for it.)  Hope this answered your question.  Good luck.

Also, I've heard that this problem is fixed in system 7.0.  Can anyone confirm
this?

						-Mark Waldmiller
..Sorry no .Sig

bskendig@phoenix.Princeton.EDU (Brian Kendig) (05/13/91)

In article <76189@eerie.acsu.Buffalo.EDU> v109lptc@ubvmsd.cc.buffalo.edu writes:
>>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?
>
>Actually there is a limit.  It arises because the desktop file for the Finder
>has its information stored as resources, and there is a limit to the number of
>resources any given file can contain without the system crashing.
>
>... I've heard that this problem is fixed in system 7.0.  Can anyone confirm
>this?

Correct.  System 7.0 has the Desktop Manager built in, so file
management is much faster when you're using a hard disk with a lot of
files on it.  As an added bonus, System 7.0 no longer nukes the text
in the "Get Info" boxes of your files when you rebuild the desktop.

(The Desktop Manager uses two new data-only (no resources) files:
Desktop DB and Desktop DF, both invisible and at the root level of
your hard disk.  It still uses the old-fashioned Desktop file on
floppy disks.  You can erase the old Desktop file from your hard drive
once you upgrade to System 7.0, but if you ever mount your hard drive
on a System 6 machine not running the Desktop Manager, it will
complain that your hard drive needs minor repairs, and if you give it
permission to attempt repairs, it'll just create a Desktop file.)

If you have to stick with System 6 for some reason, it's still
possible to obtain a copy of the Desktop Manager INIT: grab the
"Oscar" program from ftp.apple.com; the INIT is stuffed in there.
This is functionally equivalent to having the Desktop Manager built
in.

I believe it was System 6.0.4 or 6.0.5 that first included hooks so
the Desktop Manager could be used, and it'll probably be built into
System 6.0.8 so upgrading will mean you don't need that INIT.  (No,
6.0.8's not out, yet.)

If, when you copy a file onto your hard drive, the machine sits there
on "Updating the desktop file..." for forever and a day, then it's
time to either rebuild the desktop or get the Desktop Manager INIT.

     << Brian >>

| Brian S. Kendig      \ Macintosh |   Engineering,   | bskendig             |
| Computer Engineering |\ Thought  |  USS Enterprise  | @phoenix.Princeton.EDU
| Princeton University |_\ Police  | -= NCC-1701-D =- | @PUCC.BITNET         |
"You gave your life to become the person you are right now.  Was it worth it?"

winders@aux.support.apple.com (Scott Winders) (05/14/91)

In article <76189@eerie.acsu.Buffalo.EDU> v109lptc@ubvmsd.cc.buffalo.edu 
(Mark R Waldmiller) writes:

> Actually there is a limit.  It arises because the desktop file for 
> the Finder has its information stored as resources, and there is a 
> limit to the number of resources any given file can contain without
> the system crashing.  The limit on the number of resources is given
> in one of Apple's tech notes, I can't remember the exact value but
> it is approximately 2700. Since every file on your disk has a few 
> resources the finder uses (such as its icon, size information, and
> other such stuff), the actual number of files you can have on a
> given volume is about 700 or so.

Mark, 700 or so is certainly not the limit to the number of files on a
HFS volume. I have had volumes with 30,000 files on it (yes, desktop
updating was very slow due to the limitations of the Resource Manager 
as a database engine). 

Your concept of how the Desktop file in System 6.0.x and  earlier is a 
little flawed as well. Each file does not have an entry in the Desktop 
file that takes up a resource. Here is the text from Macintosh Technical
#210:

-----
There is a limit to the number of applications/files that the Finder can
"see" on a single volume. This limitation is imposed by the Desktop file.
The Desktop file is a resource file that the Finder uses to keep track of information about files and applications, including Finder file comments
(Get Info comments), and how these files and applications relate to each other. 

Because the Desktop file is a resource file, the maximum number of
resources it may contain is currently 2727 (refer to Technical Note #141).
To illustrate this limitation of the Desktop file, here are some example applications and how their entries currently affect the Desktop file.

-	The Finder puts a single resource into the Desktop file (the Finder is
  not on the disk).
-	MacWrite puts 10 resources into the Desktop file.
-	MacPaint puts 9 resources into the Desktop file.
-	MacDraw puts 8 resources into the Desktop file.
-	MacWrite and MacPaint together put 20 resources into the Desktop file.
-	MacWrite and MacDraw together put 19 resources into the Desktop file.
-	A generic application (no BNDL resource) or a file without any Finder
  file comments does not put any resources into the Desktop file.
-	Finder file comments put a single resource into the Desktop file.

Note: 	Both the maximum number of resources in a file, including the
Desktop file, as well as the number of resources the above examples
put into the Desktop file could change in the future.

As you can see, it is difficult to accurately predict how many applications/files will fit on any single volume.  Clearly, the more information an application or file carries with it, the larger its 
"entry" in the Desktop file.  This is normally not a problem, but with
the advent of very large capacity media, it is possible to reach this limitation by creating a single volume with too many applications/files.
-----

Scott Winders
internet: winders@aux.support.apple.com
AppleLink: winders.s@applelink.apple.com

marmoset@mondo.engin.umich.edu (Dave Walker) (05/16/91)

In article <76189@eerie.acsu.Buffalo.EDU> v109lptc@ubvmsd.cc.buffalo.edu writes:
>>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.
>>>
>
>Actually there is a limit.  It arises because the desktop file for the Finder
.
.
>I'd recommend 30-40meg volumes.  Third, and last, and I think best, you can
>use a file apple distributes with its appleshare disks called Desktop Manager.
>After placing this file in your system folder, the Mac will create two invisible
>files on the disk for tracking the desktop.  These files do not contain
>resources, so you do not run into the problem that the desktop file has.
>You should be able to get a copy of the Desktop Manager from an apple dealer
>or by asking around.  (If you can't get hold of it any other way, you can
>ask me for it.)  Hope this answered your question.  Good luck.
>
>Also, I've heard that this problem is fixed in system 7.0.  Can anyone confirm
>this?
>

Yes, System 7.0 has the Desktop Manager built in.  

IMPORTANT:  Save yourself a hassle and *remove* the Desktop Manager Init from
your System Folder before you upgrade to System 7.  The Compatibility 
Checker *does not* catch it, and if you boot your machine under 7 with the
INIT installed the INIT and System 7's desktop manager fight over the
Desktop database files.  Neither of them wins :-) and your system hangs.

Removing the Desktop Manager INIT makes everything hunky-dory.

>						-Mark Waldmiller
>..Sorry no .Sig

| Dave Walker, Detroit Art Services (DAS)                                |
| marmoset@ub.cc.umich.edu                 "I don't read, I just guess"  |
| marmoset@mondo.engin.umich.edu       -Happy Mondays, "Wrote For Luck"  |