From owner-freebsd-questions Tue Aug 18 11:18:10 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA02577 for freebsd-questions-outgoing; Tue, 18 Aug 1998 11:18:10 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from postal.isc.rit.edu (postal.isc.rit.edu [129.21.3.113]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA02551 for ; Tue, 18 Aug 1998 11:18:01 -0700 (PDT) (envelope-from aaron@csh.rit.edu) Received: from thud.homenet by osfmail.isc.rit.edu (PMDF V5.1-10 #27553) with ESMTP id <0EXW00J9ODGVDN@osfmail.isc.rit.edu> for questions@FreeBSD.ORG; Tue, 18 Aug 1998 14:17:21 -0400 (EDT) Received: (from aaron@localhost) by thud.homenet (8.8.7/8.8.7) id OAA00650; Tue, 18 Aug 1998 14:17:08 -0400 (EDT envelope-from aaron) Content-return: allowed Date: Tue, 18 Aug 1998 14:17:07 -0400 From: Aaron Jeremias Luz Subject: Re: Free BSD file system In-reply-to: <35D9C4E6.2897@echidna.com>; from Graeme Tait on Tue, Aug 18, 1998 at 11:16:06AM -0700 To: Graeme Tait Cc: questions@FreeBSD.ORG Reply-to: aaron@csh.rit.edu Message-id: <19980818141707.54820@homenet> MIME-version: 1.0 X-Mailer: Mutt 0.84e Content-type: text/plain; charset=us-ascii References: <35D9C4E6.2897@echidna.com> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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