[plug] What is the maximum file size allowed under Unix

James Bromberger james at rcpt.to
Wed Aug 1 19:29:10 WST 2001


On Wed, Aug 01, 2001 at 06:57:17PM +0800, Carl Gherardi wrote:
> > Is there an upper limit (maximum size) that a single file in a Unix
> > directory can be, or is the size of the disk drive the limit?
> > Also what is the maximum number of files that one directory can hold?
> 
> Maximun file size is determined by the default block size.
> If using: ls -sal : your directory size is 4096 then your maximum file
> size is 2G.
 
And also by the VFS layer int he kernel, which in 2.2 and earlier, was 
2 GB, but now in 2.4 is much much higher. IIRC, most limits in 2.4 are 
incredably high, like the number of UIDs available: enough for 1/4 
of the world's population or so (~1 - 2 billion).

> I dont know about a maximum number of files for a directory, but i do
> remember an article a while back talking about the accidental creation of
> 65536 files in a directory bringing the system to a crawl. (Article was
> discussing the advantages of journaling file systems)

I once had a bad kernel create a similar number of ksymoops files in 
/var/log/ksymoops. Commands such as "ls", "rm", etc, would fail to 
be able to show or remove the contents. The only idea I had that it was 
ull in here was that the *directory* /var/lib/ksypoops had a size of several 
hundred meg (ie, not the contents). The only solution that worked was
	find /var/lib/ksymoops -name ksym\* -exec rm {} \;

Since `rm *` gave a "too many files" on the expansion (globbing) of * in 
the shell. *sigh* Indeed, a large number of files in an ext2 FS cna be slow. 
I ran a test a while back with my Debian system: exact same number of files 
in /usr/share/doc (1200 or so). One FS was ext2, one was (is) resierFS. Ext2 
took around 5 seconds to show an ls. resier was instantaneous. There have 
since been several patches proposed to ext2 code, but I dont think any of them 
have been blessed into the Linux tree yet (though I am not sure of this).

 James
-- 
 James Bromberger <james_AT_rcpt.to> www.rcpt.to/~james

 Remainder moved to http://www.rcpt.to/~james/james/sig.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20010801/0fd0b224/attachment.pgp>


More information about the plug mailing list