Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Aug 1998 14:17:07 -0400
From:      Aaron Jeremias Luz <aaron@csh.rit.edu>
To:        Graeme Tait <graeme@echidna.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Free BSD file system
Message-ID:  <19980818141707.54820@homenet>
In-Reply-To: <35D9C4E6.2897@echidna.com>; from Graeme Tait on Tue, Aug 18, 1998 at 11:16:06AM -0700
References:  <35D9C4E6.2897@echidna.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 18, 1998 at 11:16:06AM -0700, Graeme Tait wrote:
> I'm new to FreeBSD and UNIX in general, so forgive me if I'm asking some 
> elementary questions.

Well, I'm no wizard myself, but I'll give your question a shot.

> Regarding the FreeBSD filesystem, what is the equivalent of a "cluster" 
> in the DOS world? That is, if I have tiny files, how much disk space do 
> they actually occupy? My experiments suggest 1k, but I'm confused by 
> references to 512-byte blocks in various places. Is this "cluster" size 
> independent of disk or partition size?

There are three sizes involved here: 1) the device block size, which I 
believe is set to 512 bytes for historical reasons;  2) the filesystem
block size, which is usually 8K; 3) and the filesystem fragment size,
usually 1/8th the filesystem block size thus 1K.  Fragments are used
to store small files or pieces of files within whole blocks.  Whole 
blocks reduce overhead for large files thus giving better throughput
while fragments use up "slack" space.

> I have a situation that involves storing the better part of a million 
> small (700 bytes to 1.9 kbytes) files (don't ask!). From a filesystem 
> efficiency point of view, what is a practical maximum number of files per 
> directory? How many directories can you have under one directory?

The filesystem should remain efficient.  However, applications which
read the directory may be overwhelmed.  For example, ls sorts the names
of the files in a directory before outputing them.  Running ls on a
directory with many thousands of files in it could take a while.

> Where is this kind of thing documented? I have scanned "The Complete 
> FreeBSD" book, and have searched the online docs without success.

Try reading "A Fast File System for Unix" by McKusick et al.  This
explains all the gory details you might want to know and also gives
a good discussion about how block size affects performance / space
available for data.  This and many other fascinating Unix related
papers are available at http://www.freebsd.org/doc.

Also read the manual page for newfs(8).  If you have the time and 
resources available, try creating a filesystem with a 4KB block size
and see how that affects space used and performance.

Aaron

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980818141707.54820>