Operating System - HP-UX
1835910 Members
2530 Online
110086 Solutions
New Discussion

Re: faster alternative to du

 
Niraj Kumar Verma
Trusted Contributor

faster alternative to du

Hi,

Is there any faster alternative to calculate disk spce on LINUX/HPUX than du?

du takes long time to calculate 150 GB space ..

Regards
Niraj.Verma@philips.com
5 REPLIES 5
Peter Godron
Honored Contributor

Re: faster alternative to du

Niraj,
Thread covering a perl alternative:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=227734
seems to provide an answer, but as Procura tested, the answer was still slower.
Niraj Kumar Verma
Trusted Contributor

Re: faster alternative to du

Hi,

I am not quite ablet ot use the above link...
is there any other thread or any other idea ?

Regards
Niraj.Verma@philips.com
Sung Oh
Respected Contributor

Re: faster alternative to du

I often use "bdf" for calculating the disk spaces for hpux and "df" for Linux. I am not sure if bdf is any faster then du; however, I have a server with three 146GB hard drives and it took less then one sec for "#time du -h" to be issued.

real 0m0.007s
user 0m0.001s
sys 0m0.006s

I hope this any help to you.

Sung
Peter Godron
Honored Contributor

Re: faster alternative to du

Hi,
sorry you can't access the thread I mentioned earlier.

I have attached the perl code by Stanimir Hadzhinikolov as perl.txt.

Brian Bergstrands code was:
use File::Find;
my $base = $ARGV[0] || "./";
my $total = 0;
sub addsize {
$total += -s;
}
find(\&addsize, $base);
print "$total\n";

Procura's code was:
timex perl -MFile::Find -le'find(sub{$s+=-s},".");print$s'

The normal reason for the slowdown problem with du is not really the size of the filesystem, but the number of files.
Peter Godron
Honored Contributor

Re: faster alternative to du

Hi,
sorry you can't access the thread I mentioned earlier.

I have attached the perl code by Stanimir Hadzhinikolov as perl.txt.

Brian Bergstrands code was:
use File::Find;
my $base = $ARGV[0] || "./";
my $total = 0;
sub addsize {
$total += -s;
}
find(\&addsize, $base);
print "$total\n";

Procura's code was:
timex perl -MFile::Find -le'find(sub{$s+=-s},".");print$s'

The normal reason for the slowdown problem with du is not really the size of the filesystem, but the number of files.