Novell's NetWare product manuals state limits about the number of directory entries and the number of directory blocks per volume for 3.x and 4.x products. Users often report that they can exceed these limits long before filling a volume with data. Some are unable to understand why they cannot create a directory or new file while utilities like NDIR.EXE, VOLINFO.EXE or SERVMAN.NLM indicate some directory entries are free on the volume.
The purpose of this document is to explain how NetWare 3.x and 4.x OSes allocate disk blocks for directory entries and why reported free directory entries do not guarantee new directory blocks can be allocated. Some clarification will be given in the light of mixed terminology. Finally, recommendations for short-term and permanent solutions are suggested.
The terms directory, directory entry , and slot have been used interchangeably in NetWare utilities which report file system statistics. To avoid ambiguity, this document will use the term directory entry. A directory entry will be defined as a 128-byte unit, and a 4-KB directory block will hold 32 directory entries. The unit will be referred to as a directory entry, even if it contains no directory entry information. Files on volumes with multiple name spaces require multiple directory entries per file. Directory entries with no information are allocated, but will be referred to as unused. Directory entries which hold file/directory information will be allocated and used. The following table illustrates the differences between three commonly used utilities.
Utility Allocated Unused Used
NDIR.EXE /VOL Maximum directory entries Available directory entries -
VOLINFO.EXE Total Directories Free Directories -
SERVMAN.NLM Directory Entries - Used Directory entries
Table 1a. Various representations of directory entry information.
NetWare 3.x, 4.01, 4.02 and 4.10 were designed to support a maximum of 2,097,152 directory entries. The number 2,097,152 is 2 to the 21st power (or 2 x 1024 x 1024). For the sake of convenience, future references to the number 2,097,152 will use 2M as a substitute.
NetWare 4.11 has increased the limit to 16M directory entries per volume.
Background Theory: The Governing Principles
Before pursuing a discussion of symptoms and solutions it is important that some fundamental principles of the NetWare file system be outlined. Once these principles or rules are given, the remaining text will be much more easily understood. For the purposes of this document, the basic rules are:
1. The absolute maximum number of directory entries per volume that NetWare supports is 2M (16M for NW4.11). Whether the directory entries are used or unused, if they have been allocated, they count against the 2M (or 16M) maximum allowable. Once the limit is met, no new directory blocks may be allocated on the volume, unless directory blocks are freed by deleting and purging directories and/or files.
2. Every directory is the parent to a linked list of one or more 4-KB directory blocks. When a directory is created, a new 4-KB block is allocated and becomes the first block. As needed, other directory blocks will be allocated and linked in the list belonging to the parent. The linked list of blocks contains the directory entry information for files residing in the directory. Additionally, directory trustee assignments will be located in these blocks, however, their impact will not be discussed in this document. For more information about trustee assignments, read the June 1992 NetWare Application Notes article entitled Directory Entry Tables and NetWare for Macintosh.
3. The directory entries for any file will always reside in a block which is part of a linked list belonging to the parent directory. When a file is created, its directory entry (directory information) is written in a block in the linked list belonging
to the parent directory. If, at the time the file is created, the existing blocks in the parent's linked list are full, then a new 4-KB block is allocated and linked in the list.
4. Deleted and purged directories will free blocks which can be linked with new parents. Once a directory has been deleted and purged, the directory block is freed from the linked list. In NetWare 3.x and 4.0x, freed blocks do not change the statistic, allocated directory entries. However, in 4.10 the number of allocated directory entries reported will reflect the fact that directories have been deleted and purged. In either case, the freed block can subsequently be used and linked to any parent directory.
5. Deleted and purged files, which do not free entire directory blocks, will free directory entries which can be used only by new files created in the same parent directory. This is basically a restatement of rule 2 above. If directory entries in a directory block are free at the time a file is created in the same parent's directory, the directory entries may be used for the files directory information.
6. If all the files whose directory entries reside in and constitute a full directory block are deleted and purged, then the entire block is freed from the linked list. If enough files are deleted and purged to free an entire 4-KB directory block, then the block is freed from the linked list and is available for any subsequent directory block allocations.
Symptoms: I can't create a directory, or I can't create a file in certain directories.
One common symptom reported is "NDIR /VOL indicates I have 783,402 free directory
entries on my volume, but I can't create a new directory. I get an error Not enough
Memory' What is wrong?" Another similar report is "I have free directory entries on my
volume, but I cannot create another file in certain directories. Why?" What appear at first to be inconsistencies in reporting and handling of directory entries becomes clear as the algorithm for disk and directory entry block allocations is understood.
Troubleshooting and Verification: 2,097,152 (2M) is the absolute maximum number of directory entries per volume for NetWare 3.x, 4.01 and 4.02. NetWare 4.11 allows 16M maximum directory entries per volume.
First it is important to verify that any error report to the effect that a file or directory
cannot be created is indeed due to a real OS limit and not some hardware/software
problem. This is a simple step. Use the NDIR.EXE (NDIR /VOL) for 4.x and VOLINFO.EXE for 3.11 and 3.12 NetWare. Look at maximum directory entries in the NDIR or Total Directories in the VOLINFO utility. If these report 2M (or 16M for NetWare 4.11), and the file/directory creation fails with the message "Error expanding <volume name/ directory name> directory because directory size limit was reached" then it will not be possible to create any new directories and file creation may not be possible in some directories. Essentially, if the creation of a file requires another directory block to be allocated, it will fail. The message will occur only once at the file server and at the work station. Subsequent messages, indicating the same problem, at the workstation will say "Not enough Memory."
File Limits per Volume: What is the maximum number of files I can create on a volume?
The maximum number of files which can reside on a volume will vary according to the
directory structure and the number of name spaces supported on the volume. In the
simplest case, a volume with no subdirectories, all files created at the root of the volume, and DOS name space only, the maximum number of files is something less than 2M (16M for NetWare 4.11). One or more directory blocks are allocated for directories at the root of the volume which cannot be used for files at the root. That makes the total number of available directory entries for files fall a few short of the theoretical maximum.
Dependancy on the Number of Name Spaces
Given the same directory structure, but having two name spaces will reduce the maximum number of files in half to approximately 1,048,000 or 1M for pre NetWare 4.11. A third name space will reduce the maximum to approximately 699,000 or M. The reason: each additional name space causes each file to use another directory entry. The method is to divide 2M by the number of name spaces (including DOS) to approximate the maximum number of files that can reside on the volume. The actual number of files will be further dependent on the file/directory structure on the volume.
Dependancy on the Directory Structure
How the file/directory structure of the volume impacts the total number of files can best be illustrated with an example (based on 3.x - 4.10 limits). For simplicity, this example will use a volume having only DOS name space. At the root of the empty volume, 63,555 directories can be created before the 2M directory entry limit is met. Each directory causes a new 4-KB directory block to be allocated on the disk. By the previous definition, each block has 32 directory entries. Observing statistics using NDIR /VOL, after having created 63,555 directories, the maximum directory entries (allocated) and the available directory entries (unused) are roughly equal, because the directory entries are allocated, but not yet filled with directory information. Some overhead in blocks managing the directories is required and accounts for the difference between the allocated and unused directory entries. As files are added to the directories, the number of unused directory entries will decrease.
Once the maximum number of directory entries are allocated, no more directory blocks can be allocated, unless files/directories are deleted and purged. The number of files that can be created in any given directory is that which can be created before another block is required. Although there will be many directories which have unused directory entries, files can only use directory entries in the blocks linked to the parent directory (see rule 3 in Background Theory, above. Here is an example (pre NetWare 4.11):
2M directory entries have already been allocated on a volume having only DOS name
space. No files/directories have been deleted and purged. A directory named APPS
contains 149 files. To determine how many more files can be created in the directory
APPS, divide the number of files by 32 and determine the remainder. Subtract the
remainder from 32 to calculate the number of directory entries left in the last block.
149 / 32 = 4 + remainder of 21
32 - 21 = 11
This tells us that 4 directory blocks are full and there are 21 directory entries used in
the 5th block. In this case 11 files can be created (32 directory entries per 4 directory
block with one name space). The 12th file would require the allocation of another
block. All other free directory entries on the volume are linked to different parent
directories and cannot be used except for files in the respective parent directory.
Here is an example on a volume having three name spaces:
2M directory entries have been allocated on a volume which has DOS, MAC and NFS
name spaces. No files/directories have been deleted and purged. A directory named
SALES contains 91 files. How many more files can be created in the directory
SALES? Divide the number of files by 10 ( 3 name spaces 3 directory entries
per file or 10 files per 4-KB directory block) and determine the remainder. Subtract
the remainder from 10 to calculate the number of files whose entries will fit in the
91 / (10 ) = 8 + remainder of 5
This means 8 full 4-KB directory blocks were used. The remainder, 5 , represents
the number of files used in the partial block. The number of actual directory entries
would be (3 * 5 ) or 17. For this example with 3 name spaces, the value is
normalized to represent files rather than directory entries. Therefore, 5 is the
remainder. Subtracting 5 from 10 yields the number of files that will fit in the
10 - 5 = 5
Five files can be created in the SALES directory before another 4-KB directory block
must be allocated.
Directory Entry Limit Short-term Solutions: Backup or Move and Delete Files/Directories
For a short-term solution to a volume which has reached the 2M (or 16M) directory entry limit, a user might consider backing up selected portions of the file system, then deleting and purging the backed up data. Obvious cautions would include verifying the backup and deleting only the directories and files which have been backed up. Alternatively, if
another volume on the server can accommodate more files and directories, selected portions could be copied, deleted and purged.
The Long-term Solution: Split the Single Volume into Multiple Volumes
The most permanent solution to the directory entry limit is to break the affected volume into multiple volumes. Once multiple volumes exist, the total server limit for directory entries is the number of volumes times 2M (16M for NetWare 4.11). Recommendations for how big a volume should be are difficult to make because of the diversity of user applications, file sizes, and directory structure requirements. Application of the rules for creating directories and files plus the knowledge of the impact of additional name spaces should help in determining volume sizes. More name spaces and more complex directory structures would require smaller volumes. Ultimately, the network or server administrator will have to make a final judgement regarding the optimal volume size for the application.
Directory and file number limits are not the only compelling reasons for dividing applications into smaller volumes. Managing multiple smaller volumes during backups, restores and volume repairs is often more desirable than managing a single large volume. In the event of a volume related failure a single volume leaves users without access to data. Conversely, if one volume fails, and applications are distributed on multiple volumes, users will have access to some subset of the server data while the failing volume is being repaired or restored.
NWAdmin and Directory Entries
NetWare Administrator will report statistics for directory entries, but they are misleading. Users will often report that NWAdmin is reporting that they have used 70% of their directory entries, thus causing the user to believe there is only 30% left. Instead, what the pie chart is reporting is the current static numbers that servman has. For instance, if servman reports 14,000 directory entries and 10,000 used directory entries, NWAdmin will create a pie chart by dividing 10,000 by 14,000 (approx. 70%) and report that the server has used 70% of available directory entries. This is true, but it is misleading because directory entries are dynamic. As stated before, intraNetWare has a limit of 16 million per volume and NetWare 4.x and 3.x have a limit of 2 million per volume. Therefore, 14,000 is not even close to the limit of a volume. If the server need more than 14,000 directory entries, it will allocate them.
Note: On upcoming Netware 5 Novell Storage Service (NSS), Directory Entry limitation do not exist.