Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jun 2000 11:51:21 +0100 (BST)
From:      Jan Grant <Jan.Grant@bristol.ac.uk>
To:        Mac <mac@ngo.org.uk>
Cc:        "Rafael A. Reta Rodriguez" <rafareta@icave.com.mx>, freebsd-questions@freebsd.org
Subject:   FINDING LOST DISK SPACE Was: Where is the disk pace?
Message-ID:  <Pine.GHP.4.21.0006291146060.12683-100000@mail.ilrt.bris.ac.uk>
In-Reply-To: <200006291030.LAA08370@ngo.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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