From owner-freebsd-questions@FreeBSD.ORG Thu Jul 28 15:57:47 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E6D916A428 for ; Thu, 28 Jul 2005 15:57:47 +0000 (GMT) (envelope-from bob89@eng.ufl.edu) Received: from scorpion.eng.ufl.edu (scorpion.eng.ufl.edu [128.227.116.10]) by mx1.FreeBSD.org (Postfix) with SMTP id 613E543D45 for ; Thu, 28 Jul 2005 15:57:46 +0000 (GMT) (envelope-from bob89@eng.ufl.edu) Received: (qmail 13397 invoked from network); 28 Jul 2005 15:57:43 -0000 Received: from scanner.engnet.ufl.edu (128.227.152.221) by scorpion.eng.ufl.edu with SMTP; 28 Jul 2005 15:57:43 -0000 From: Bob Johnson Organization: UF College of Engineering To: freebsd-questions@freebsd.org Date: Thu, 28 Jul 2005 11:57:42 -0400 User-Agent: KMail/1.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507281157.42688.bob89@eng.ufl.edu> Cc: Victor Semionov Subject: Re: defragmentation in FreeBSD 4.11 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2005 15:57:47 -0000 Message: 6 Date: Thu, 28 Jul 2005 11:20:31 +0300 From: Victor Semionov Subject: Re: defragmentation in FreeBSD 4.11 To: freebsd-questions@freebsd.org Message-ID: <200507281120.31564.victor@vmpbg.com> Content-Type: text/plain; charset="windows-1251" > > This is one of the things I find really hard to get Windows users to > > understand. They just won't believe that a company like Microsoft would > > still be using a filesystem that needs defragmenting if it were possible > > to design one that didn't. I often wonder why myself - after all, they > > must have put a fair amount of work into NTFS, which at least doesn't > > seem to get corrupted in a power failure. Did they make a trade-off I > > don't understand, or is it just incompetence - or worse, a deal with > > disk manufacturers to sell more disk? > Microsoft used to claim that NTFS doesn't need defragmentation. Compared to MSDOSFS, that's a reasonably accurate statement, but if you push it hard enough, it will still become fragmented. > Why is it unnecessary to defragment UFS? > In normal use, files never become fragmented enough to affect performance. In a (loose) sense, files are intentionally fragmented in a controlled way so that fragmentation doesn't cause problems. If you run fsck on a partition, you will typically see fragmentation levels of less than one percent. Also, keep in mind that in the default formatting, a FreeBSD partition has 8% of the disk space withheld from normal users to help keep the disk from becoming so full the system can't operate, and it has the side effect of helping to prevent fragmentation as well. It is why df can show a disk being as much as 108% full. It is possible to make this space available for normal use if, for example, you are using a partition only for data storage and you want to squeeze every last bit of space out of it, but of course there will be some performance penalty as it starts to get full. You can also adjust other disk parameters to optimize for your particular needs. See tunefs(8). If the disk gets close enough to full, the OS has no choice but to start fragmenting things. Try to keep your disks less than about 90% full (that's a number I remember from somewhere -- it's just a guideline and not a firm limit). My /home partition is 95% full according to df (which means it is actually a little under 90% full including the reserved capacity), and fsck shows 0.1% fragmentation. Of course, it's a fairly big partition, so it still has over a gigabyte of free space. Even the ISO CD images I downloaded a few days ago probably didn't get much fragmentation. - Bob