APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > Unix Articles > Maximum size of a directory
Printer Friendly Version




Maximum size of a directory


In a recent thread, someone asked how to know how much of a directory is used; that is, information similar to "df" but for a specific directory.

Of course it's a silly question in some respects. Did he mean the percentage of file space used by this directory relative to that available on the file system? Or the number of files that exist as a percentage of the maximum number that could be created? We don't usually concern ourselves with either of those things, so there are no tools that output anything like that.

But there are limits to directories, of course. For one thing, a directory is a file like any other file, and therefore is limited in size by whatever restraints the file system puts upon it. It probably has some minimum space for the name part of its entry, and a fixed space for the inode part, so you couldn't possibly have more entries than could fit in the maximum file size. Also, there are inode limits imposed by the filesystem: if the directory could theoretically hold some impossibly large number of files, it might be impossible for that many files to exist on the file system. Not the directory's fault, of course, but still a limit.












Every file system is going to impose some limit on the maximum number of files in a directory, and may impose a different limit on files with special needs like directories (because of the links that need to be kept track of). Nowadays those limits may be very large, but they do exist.

And then we have other limits. Some file systems use a hash for file names, and are going to run into unavoidable collisions at some point that may be much smaller than any other design criteria. The Reiser FAQ currently says that it allows almost 4GB of files in a directory, but:


 in practice this value is limited by hash function. r5 hash allows
 about 1 200 000 file names without collisions
 


That's more than enough entries for me, thanks.


If this page was useful to you, please click to help others find it:  

Your +1's can help friends, contacts, and others on the web find the best stuff when they search.

7 comments




More Articles by Anthony Lawrence - Find me on Google+



Click here to add your comments





Tue Nov 22 05:31:29 2005:   anonymous


4GB of files? Do you mean a number or a size in GB?



Tue Nov 22 10:45:03 2005:   TonyLawrence

gravatar
Number of files.





Thu Sep 6 19:23:35 2007:   anonymous


"That's more than enough entries for me, thanks."


Now. Today. Ten years from now? Nope. Not nearly enough. In fact, I got to this thread looking to see if its OK to copy about a quarter million data files into an ext2 directory, because it will be convenient for later processing. Having to devise and use a subdirectory scheme would be a royal pain.


It will only get "worse," or rather, easier to generate and use huge numbers of digital assets.





Sat Dec 22 14:35:52 2007:   anonymous


Clearly you pick and choose which questions to answer.. here you chose one, labelled it "silly," pointed out the inadequacies of its phrasing, and then made a point of smirking your way through an incomplete answer If your real goal is to insult your audience maybe you should consider stand-up comedy, or better yet: therapy.



Sat Dec 22 17:28:01 2007:   TonyLawrence

gravatar
Oh, come on: lighten up. I'm not "smirking my way" through anything - I said "in one sense it's a silly question" but then went on to answer it as best I can.

As to "picking and choosing", you are dead wrong. I make no pretense of omniscience and have always cheerfully admitted when I have no freaking idea or the question is way over my head.

By the way, how is it "clear" to you anyway? According to my logs, this is the ONLY post you have read here - at least this month. I suppose I could check back farther..




Tue Dec 15 12:22:57 2009:   siyaram

gravatar
how many can stored max.data in a folder when space avilable ?



Tue Dec 15 12:41:57 2009:   TonyLawrenc

gravatar
I'm sorry - I do not understand what you are asking. Can you rephrase your question?

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide




 I sell and support
 Kerio Mail server
pavatar.jpg

This post tagged:

       - Disks/Filesystems




Unix/Linux Consultants

Skills Tests

Guest Post Here