From owner-freebsd-questions Thu Jun 29 3:51:37 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dire.bris.ac.uk (dire.bris.ac.uk [137.222.10.60]) by hub.freebsd.org (Postfix) with ESMTP id 4635B37B866 for ; Thu, 29 Jun 2000 03:51:29 -0700 (PDT) (envelope-from Jan.Grant@bristol.ac.uk) Received: from mail.ilrt.bris.ac.uk by dire.bris.ac.uk with SMTP-PRIV with ESMTP; Thu, 29 Jun 2000 11:51:22 +0100 Received: from localhost (cmjg@localhost) by mail.ilrt.bris.ac.uk (8.8.7/8.8.8) with ESMTP id LAA06400; Thu, 29 Jun 2000 11:51:21 +0100 (BST) Date: Thu, 29 Jun 2000 11:51:21 +0100 (BST) From: Jan Grant To: Mac Cc: "Rafael A. Reta Rodriguez" , freebsd-questions@freebsd.org Subject: FINDING LOST DISK SPACE Was: Where is the disk pace? In-Reply-To: <200006291030.LAA08370@ngo.org.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 29 Jun 2000, Mac wrote: > > > > du says that I have 2,638K and df says 14,094K used... What is grong > > The classic cause of this is a large file that's been deleted (so it > doesn't show up in directory listings (or 'du')) but the file's still > open and being used by a process somewhere, so the kernel doesn't delete > it. it is possible to identify which inodes are in use but not represented in the filesystem. This should go some way to helping you track down your problem. Use the following script (run it as "./openfiles /var/log") - should do what you're after. [begin file openfiles] #!/bin/sh if [ $# != 1 ] then echo Usage: "$0" filesystem exit fi filesystem="$1" openinodes=`fstat | awk '\$5 == "'$filesystem'" { print $6 }' | sort -n | uniq` echo Open inodes in "$filesystem": $openinodes # Scan for each inode unaccounted='' for i in $openinodes do fn=`find -x $filesystem -inum $i 2>/dev/null` if [ "x$fn" = "x" ] then unaccounted="$i $unaccounted" else echo Found inum $i is file "$fn" fi done echo Inodes unaccounted for appear to be "$unaccounted" for i in $unaccounted do echo Unaccounted inode $i is used by these processes: fstat | awk 'NR==1 || $5 == "'"$filesystem"'" && $6 == "'$i'"' done [end file: openfiles] I think that's what you're after..? -- jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/ Tel +44(0)117 9287163 Fax +44 (0)117 9287112 RFC822 jan.grant@bris.ac.uk Bolstered by my success with vi, I proceeded to learn C with 'learn c'. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message