cancel
Showing results for 
Search instead for 
Did you mean: 

Finding large files in root

phil lawton
Occasional Contributor

Finding large files in root

I have a root filesystem that is above its threshold and I am trying to isolate the large files which could be causing the problem. The command I and using is........
find . -xdev -size +1000000c -exec ls -l {} \l

My understanding was that the -xdev option would restrict the search to the root directory, but the output includes large files in other filesystems.

How best can I restrict the search to only files in root?
You cab lead a horse to water, but you can't climb a ladder with a bell in both hands
6 REPLIES
Stefan Farrelly
Honored Contributor

Re: Finding large files in root


Hmm, thats strange. Ive tried your command on 2 different 10.20 and 11.0 servers and it works fine - it does NOT search mountpoints (/var, /usr, /opt etc.). It only searches root which includes /etc, /dev

What version of find are you running ? maybe a patch issue. Mine is Revision 82.3 (99/10/04)
Im from Palmerston North, New Zealand, but somehow ended up in London...
Steve Steel
Honored Contributor

Re: Finding large files in root

Hi

1)Try sam
routine tasks
selective file removal

2)What are the file systems it enters.

If AFS this is third party


steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
phil lawton
Occasional Contributor

Re: Finding large files in root

Thanks chaps. Your dead right, it does work! Nothing more than a case of Fat Finger Syndrome.

Thanks anyway.
You cab lead a horse to water, but you can't climb a ladder with a bell in both hands
Jeff Schussele
Honored Contributor

Re: Finding large files in root

Hi Phil,

A simple command I always use from the root of a FS is
du -akx | sort -nr | more
This WILL restrict to the FS & sort descending.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven Sim Kok Leong
Honored Contributor

Re: Finding large files in root

Hi,

If you want to find the large files in a specific directory, then do this eg. for /:

# ll / | awk '{print $5,$9}' | while read size name ; do if [ "$size" -ge "1000000" ] ; then echo $name ; fi ; done

Tested that it works on my system. Hope this helps. Regards.

Steven Sim Kok Leong
Email: steven@beepz.com. Homepage: https://www.beepz.com
Bill Hassell
Honored Contributor

Re: Finding large files in root

It's not a good idea to look for large files as there may not be any, or the ones larger than 1 meg are supposed to be there. Instead, use the du command as mentioned:

du -kx / | sort -rn | more

It should look something like this:

33480 /
17896 /sbin
14454 /etc
9735 /etc/opt
5507 /etc/opt/resmon
3532 /sbin/fs
3456 /etc/opt/resmon/lbin
1657 /sbin/fs/vxfs
1454 /sbin/fs/hfs
1432 /etc/lvmconf

The vast majority of problems with the root filesystem filling up is due to a misspelled device file or a directory that does not belong in root. /dev should be about 25k to 45k when you run du:

du -s /dev
36 /dev

If /dev is much larger, use this to find the culprit:

find /dev -type f

Only device files belong in /dev.

Badly written applications will install (without asking permission from root) directories in the / filesystem--they don't belong there! The correct location is /opt. Here's a recent posting on the subject:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xac6d42308663d611abdb0090277a778c,00.html




Bill Hassell, sysadmin