From owner-freebsd-questions@FreeBSD.ORG Thu Nov 29 13:42:47 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46F0E16A417 for ; Thu, 29 Nov 2007 13:42:47 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from mail.potentialtech.com (internet.potentialtech.com [66.167.251.6]) by mx1.freebsd.org (Postfix) with ESMTP id 26EE113C45A for ; Thu, 29 Nov 2007 13:42:47 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from vanquish.pitbpa0.priv.collaborativefusion.com (pr40.pitbpa0.pub.collaborativefusion.com [206.210.89.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTP id 022E8EBC3C; Thu, 29 Nov 2007 08:42:45 -0500 (EST) Date: Thu, 29 Nov 2007 08:42:44 -0500 From: Bill Moran To: Wojciech Puchar Message-Id: <20071129084244.eaba6f7a.wmoran@potentialtech.com> In-Reply-To: <20071129122043.A9040@wojtek.tensor.gdynia.pl> References: <005901c8313f$f7048b70$0d00a8c0@bayoucshaffer> <474CA49D.50306@FreeBSD.org> <002001c831d5$80ad8670$0d00a8c0@bayoucshaffer> <003101c831da$a405bc50$0d00a8c0@bayoucshaffer> <20071129122043.A9040@wojtek.tensor.gdynia.pl> X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd6.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org, Mark Evans Subject: Re: ls -l takes a forever to finish. 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, 29 Nov 2007 13:42:47 -0000 In response to Wojciech Puchar : > > ls | wc > > strange. i did > > [wojtek@wojtek ~/b]$ a=0;while [ $a -lt 10000 ];do mkdir $a;a=$[a+1];done > > completed <25 seconds on 1Ghz CPU > > ls takes 0.1 seconds user time, ls -l takes 0.3 second user time. > > unless you have 486/33 or slower system there is something wrong. Another possible scenario is that the directory is badly fragmented. Unless something has changed since I last researched this (which is possible) FreeBSD doesn't manage directory fragmentation during use. If you're constantly adding and removing files, it's possible that the directory entry is such a mess that it takes ls a long time to process it. Of course, Wojciech's test won't demonstrate this, as the directory is freshly created, even to the point that the filenames are actually in alpha order in the directory. One method to test this would be to tar up the directory and extract it somewhere else on the machine (assuming you have enough space to do so). If the newly created directory doesn't have the problem, it's likely that the directory entry has become a mess. Use ls -l to compare the sizes of the actual directories themselves as a little exercise. Anyway, if that turns out to be the problem, you can fix it by taring the directory and then restoring it from the tarfile. Not an ideal solution, mind you. -- Bill Moran http://www.potentialtech.com