Operating System - HP-UX
1820160 Members
3172 Online
109620 Solutions
New Discussion юеВ

Re: Best method of finding large files in HP-UX

 
SOLVED
Go to solution
Douglas Goss
Occasional Contributor

Best method of finding large files in HP-UX

What is the best (fastest) method of finding large files that will cause a directory (i.e. /usr) to go to 100%. I check for core dumps and log files immediately but there has to be a better way to find huge files quickly.
Thanks for any assistance.
10 REPLIES 10
Bill McNAMARA_1
Honored Contributor

Re: Best method of finding large files in HP-UX

This is a cut and paste of a current question
in patches.
It describes how to use find and du to search
for large space users
To find particular files that are large
you'll use find with a -size option

Later,
Bill
--------------------------------------------------------------------------------
1) /var/tmp - used by some application. You may remove some files which are not accesed let's say in 7 days.
# find /var/tmp -atime +7 -exec rm {} ;

2) /var/adm/crash - system panics
Example: /var/adm/crash/core.0/core.0.1.gz

3) Perfview datafiles........ /var/opt/perf/datafiles.
CITEC HP TEAM



--------------------------------------------------------------------------------
Here is a one-liner (take out the \ and put it all on one line) that will help you narrow down which directories are taking the most space:

du -kx | awk -F/ 'NF==2' | sort -n

Run it in /var first, then run it again in the directories that show up at the bottom of the list.

The SD patch commit mentioned above is only relevant if /var/adm/sw is one of the directories that is causing your problem.
It works for me (tm)
Douglas Goss
Occasional Contributor

Re: Best method of finding large files in HP-UX

Thank you for the quick response... However I should have framed the question better. I think that your answer works on a directory by directory search. Can you
think of a way to search the entire file structure and find all huge files, while providing the path to them.

Thank you for your kind assistance.
Frederic Soriano
Honored Contributor
Solution

Re: Best method of finding large files in HP-UX

Hi Doug,

You can try this quick and dirty script; let's name it bigfiles.sh:

--snip--
#!/bin/sh

if [ $# -eq 2 ]
then
find $1 -type f -xdev -size +$(expr "$2" \* 2) -exec ll -d {} \;
else
echo "Usage : ${0##*/} "
fi
--snip--

Run it this way:

./bigfiles.sh /var 5000

HTH !

Best regards.

Fred.
James R. Ferguson
Acclaimed Contributor

Re: Best method of finding large files in HP-UX

Hi Doug:

To find files larger than some number do the following, for example:

# find /var -size +10000c -exec ls -l {} \;

This would find all files in /var whose size in (c)haracters exceeds 10,000. An 'ls' listing of these files would be output to stdout.

Note the plus (+) argument denotes greater than; a minus (-) would mean less than and the absence of either sign would imply equal. The "c" signifies characters instead of blocks.

See the man pages for 'find' for more useful information.

Regards!

...JRF...
Satish Y
Trusted Contributor

Re: Best method of finding large files in HP-UX

Hi Doug,

Suppose if u want to find files, whose size is greater than 1MB:

# find /usr -type f -xdev -size +1000000c -exec ll {} \;

'c' after 1000000 indicates charactors(as charactor occupies one byte)

(+) indicates greater than and (-) indicates less than

You should use "-xdev" because it is a position-independent term that causes find to avoid crossing any file system mount points.(Means searches with in filesystem, e.g. if /usr/extra is another filesystem it won't goes into directory /usr/extra)

Hope this helps you.

Cheers...
Satish.
Difference between good and the best is only a little effort
Douglas Goss
Occasional Contributor

Re: Best method of finding large files in HP-UX

Thanks everyone for the kind assistance.
John Bolene
Honored Contributor

Re: Best method of finding large files in HP-UX

I change to the dir I want to look at and
du -x|sort -rn|more

This makes a descending list of file and directory sizes.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Chris Fluegge_1
New Member

Re: Best method of finding large files in HP-UX

I use this:

find / ! -local -prune -o -size +1000000c -exec ls -la {} \; | awk {'print $5, $9'}

If you are running 10.x then you'll have to use -xdev; else you'll start to crawl the NFS mounts.

Hope this helps...
Fail to plan and you plan to fail.
Dieter Degrendele_1
Frequent Advisor

Re: Best method of finding large files in HP-UX

Hi,

When the core files constantly are saved in the same directory you could always create a directory (or whatever) with the name core. Do not forget to set the security. In this way, corefiles will not be saved!

Regards,
DD
The possible we did, the unpossible we're doing but for a miracle you have to wait some time.
Dieter Degrendele_1
Frequent Advisor

Re: Best method of finding large files in HP-UX

Hi,

When the core files constantly are saved in the same directory you could always create a directory (or whatever) with the name core. Do not forget to set the security. In this way, corefiles will not be saved!

Regards,
DD
The possible we did, the unpossible we're doing but for a miracle you have to wait some time.