Hi.
Change :
open DU,"du -sh * |" or die;
to :
open DU,"du -sh * .[^.]* |" or die;
This will also list the "hidden" files and directories.
This is simpler but may show you what you want :
du -x / | sort -n
If you have processes writing to a file that is large, try:
sudo /usr/sbin/lsof +D / | grep "REG\|TYPE" | sort -k 7n
It sounds like you have a corrupt file system. Boot up in single user
mode and force an fsck on the "/" partition. With any luck it will find
the problem. If none of this helps, backup your data and check for a
"root" kit, whether or not you find a root kit, reformat and reinstall.
Happy hunting.
Shu Hung (Koala) wrote:
Thanks. I've ran the script. Here is the result of folders in "/"
partition:
Dirs:
4.0K misc
4.0K initrd
4.0K opt
4.0K selinux
12K mnt
12K tmp
16K lost+found
212K root
568K dev
5.0M bin
12M sbin
57M etc
76M lib
195M var
513M proc
3.0G usr
There is nothing in the partition has a "G" size except the 3.0G "/usr"
Doesn't seem to have anything capable to fill up a 20G partition ......
Ben Steeves:
On Tue, 26 Oct 2004 11:56:26 +0800 (HKT), HaJo Schatz <hajo@xxxxxxxx> wrote:
Had this issue once and found it too tedious to try and run through my
whole fs with du. Since then, I keep a graphical util handy. Try eg
filelight (http://methylblue.com/filelight/ ). That should instantaneously
show you where your space went.
Share and enjoy (and no comments on the lazy programming -- I banged
this together quickly):
#!/usr/bin/perl
open DU,"du -sh * |" or die;
while (<DU>) {
chomp;
($size, $file) = split /\s+/,$_,2;
if ($size =~ /([0-9\.]+)([k|M|G])/) { $num = $1; $mod = $2; }
else { $num = $size; $mod = 1; }
if ($mod eq '1') { $num = $num * 1; }
if ($mod eq 'k') { $num = $num * 1000; }
if ($mod eq 'M') { $num = $num * 1000000; }
if ($mod eq 'G') { $num = $num * 1000000000; }
if (-d $file) { $dirs{"$num|$size|$file"} = 1; }
else { $files{"$num|$size|$file"} = 1; }
}
close DU;
print "Files:\n";
foreach (sort {$a <=> $b} keys %files) {
($num, $size, $file) = split /\|/,$_,3;
print "$size\t$file\n";
}
print "Dirs:\n";
foreach (sort {$a <=> $b} keys %dirs) {
($num, $size, $file) = split /\|/,$_,3;
print "$size\t$file\n";
}
--
Guy Fraser
.