Computing.Net > Forums > Unix > Largest file in a file system

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Largest file in a file system

Reply to Message Icon

Name: Bill
Date: August 27, 2003 at 12:34:56 Pacific
OS: HP UX 11.0
CPU/Ram: 8 900/8GB
Comment:

How do I find out what the largest files are in a file system?? In other words, if I get the message that /tmp is 90% full and /tmp is not a raw slice but a file system, how do I find out what the 20 largest files are and their complete path??

Any help on this would be very much appreciated...

Thanks!!

Bill



Sponsored Link
Ads by Google

Response Number 1
Name: Jake
Date: August 27, 2003 at 16:34:58 Pacific
Reply:

Other people will probably be able to write some nice scripts for you, but I've found the best solution on Linux to be fsv. I don't know much about HP-UX, but I found what looks to be an HP-UX version of fsv.


0

Response Number 2
Name: nails
Date: August 27, 2003 at 19:31:42 Pacific
Reply:

Bill:

Here's a one liner getting the 20 largest files in /tmp:

# all on one line
find /tmp -type f -print | xargs ls -l | sort -r -n -k 5,5 | head -20

Regards,

Nails


0

Response Number 3
Name: David Perry
Date: August 28, 2003 at 04:39:16 Pacific
Reply:

You could also do the ls within the find command like this:

find /tmp -type f -exec ls -la {} \; | sort -r -n -k 5,5 | head -20


0

Response Number 4
Name: nails
Date: August 28, 2003 at 07:12:02 Pacific
Reply:

Hi:

Most modern *nixes probably avoid the problem, but using find's -exec is always a risk of overflowing the command-line buffer given enough files. Using xargs guarantees this won't happen.

Regards,

Nails


0

Response Number 5
Name: Bill
Date: August 28, 2003 at 15:29:38 Pacific
Reply:

Nails,

I tried your xargs command and that got me most of what I wanted...The problem is that I got the 20 largest files under /tmp, but I didn't get the 20 largest files in the /tmp "filesystem"...

When I ran it on the 2 largest files I got this:

-rw-r--r-- 1 oracle dba 714559 Aug 20 2002 /tmp/admin/export.dmp
-rw-r----- 1 oracle dba 558828 May 16 2002 /tmp/files/dh_out.txt

If I go and do a "df -k ." from /tmp/admin and /tmp/files, I get two different filesystems (see below):

/tmp/admin (/dev/vg00/lvol1) : 8733 total allocated Kb
1893621 free allocated Kb
6840322 used allocated Kb
78 % allocation used

/tmp/files (/dev/vg01/lvol1) : 4059 total allocated Kb
2145 free allocated Kb
3787 used allocated Kb
47 % allocation used

Do you have any ideas or suggestions??

Thanks for your help so far!!

Bill


0

Related Posts

See More



Response Number 6
Name: nails
Date: August 28, 2003 at 15:54:44 Pacific
Reply:

Bill:

It should work. You must have links in your /tmp file system. I don't know about HP-UX, but the Solaris find has a -follow option which means "to follow the link". This might help:

find /tmp -type f -follow -print | xargs ls -l | sort -r -n -k 5,5 | head -20

Regards,

Nails




0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Largest file in a file system

to see unix file system in windows www.computing.net/answers/unix/to-see-unix-file-system-in-windows/3206.html

File system full !! Why? & How? www.computing.net/answers/unix/file-system-full-why-amp-how/2329.html

deleting rows in a file www.computing.net/answers/unix/deleting-rows-in-a-file/3676.html