LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-11-2008, 01:46 PM   #1
stvy
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Rep: Reputation: 0
Locating large files in a partition


Hi,

I have a number of RHELWS4.4 installations with the following partiiton scheme:

/dev/sda1 /boot
/dev/sda2 /
/dev/sda5 /home

On one of the hosts the root partition /dev/sda2 is almost full and on all the others it has hardly moved from the original installation usage of 44%. The partition is 20GB in size.

I was wondering if anyone could recommend an elegant way of looking through this /root filesystem partition only for large files.

Can anyone recommend me a syntax for use of the find command where I can limit the search based on file size?

i noticed that /proc/*/*/*core* contains a lot of large files named core. I am not an expert on the /proc virtual filesystem but I thought all the files should be of size 0 bytes.....

I am happy to take any advice on this?

Thanks,

Stvy
 
Old 01-11-2008, 02:01 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Code:
du /base/dir/of/interest | sort -n
Lists directory trees by size.

--- rod.
 
Old 01-11-2008, 02:54 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Something like:
Code:
sudo find /var /home /usr /tmp -type f -size +400M
It seems obvious that you didn't read the man page or info manual for the find command to have missed the -size option.
 
Old 01-11-2008, 03:05 PM   #4
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Since you are only worried about one filesystem, you probably only want to look at the / partition, so you will want to use the -x options to du. Also, the -s option will give you a summary. I typically start at / and work down with the following command:

Code:
du -sx /* | sort -nr |head
If /var was the worst offender, I would run:
Code:
du -sx /var/* |sort -nr |head
and keep going until I found what was using the disk (usually on / it is a runaway log or /tmp filling up, so checking there first may prove usefull).

HTH

Forrest
 
Old 01-11-2008, 03:14 PM   #5
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
jschiwal, find will not include directories that contain many small files (even if you don't include the -type), so if that is what is taking up the space, it won't help. But, you are right if it is just a single large file that is being looked for (like when you download the latest iso for your favorite disto but you didn't save it as something.iso and you can't remember where you put it, not that I would know from experience or anything ).

Forrest
 
Old 01-11-2008, 04:22 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,131

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
And stay away from /proc - especially if you have any thoughts of deleting those apparently "big" files.
/proc is an illusion - it is not using any of your disk space.
 
Old 01-11-2008, 06:10 PM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by forrestt View Post
jschiwal, find will not include directories that contain many small files (even if you don't include the -type), so if that is what is taking up the space, it won't help. But, you are right if it is just a single large file that is being looked for (like when you download the latest iso for your favorite disto but you didn't save it as something.iso and you can't remember where you put it, not that I would know from experience or anything ).

Forrest
I don't think I follow what you mean by "not include directories that contain many small files". The OP is looking for files greater than a certain size, not directories. If a directory doesn't contain a file greater than what you are searching for, it isn't skipped, it isn't printed because no file in the directory matches the criteria.

Also, searching through /etc/, /bin, /sbin/, et al would be a waste of time if you are looking for very large files. You could delete all files in /tmp as part of the shutdown process. Most distro's have an option to do that easily. If a user does something like burn a CD or DVD, there may be a large temporary image file that can be deleted.

You would be right to consider directories with a very large amount of small files. For example, a browser's cache files can add up to a considerable size. I select the "Clear privacy data when quiting" option in Firefox, not out of a privacy concern, but to keep the cache and cookie data nearly empty.

Also check for some problems that can eat up space. I had a problem develop with my updater on a previous distro version. There were thousands of empty directories being created continuously in /var/tmp until I shut down the service. Another time, I had a problem with cups which was doing something similar. ( Actually, now that I remember, it was eating memory. )

A graphical tool that shows the filesystem as proportionally sized blocks would be useful to locate where large files, or a large number of files could be hiding. There is a useful plugin for konqueror that does this.
 
Old 01-11-2008, 07:40 PM   #8
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Yes, he says he is looking for large files, but I think really he is trying to figure out what is using up all of his disk space. You are correct in your answer, I wasn't trying to say you were wrong. I was just trying to let stvy realize that it isn't just a big file that could take up room, and that he should really consider looking at things from a folder perspective, not a file perspective. What I meant by find wouldn't list directories that contain many small files is that if the entire contents of a directory are 10GB and it is made of a bunch of 10K files, it won't be in the list, and therefore he won't find it because it isn't looking at the size of a directory (because directories don't work that way).

As far as deleteing /tmp on shutdown, sure, if you are going to shutdown soon. If something is filling up /tmp or /var then I'd really be interested in figuring out what it is and stop it. My view on the question is that stvy has several machines that should be about the same disk usage, and one isn't behaving properly. It needs to be either spanked or given some medicine.

Forrest
 
Old 01-11-2008, 09:19 PM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by forrestt View Post
My view on the question is that stvy has several machines that should be about the same disk usage, and one isn't behaving properly. It needs to be either spanked or given some medicine.
And here we are in perfect agreement.
 
Old 01-12-2008, 04:52 PM   #10
stvy
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Hi,

Thanks to all the replies so far. very kind advice. I will be attempting some of the tactics on Monday morning.

Note that I did read the man page for find, (that was quite an aggressive reply..)

Admittedly I should have stated that I had looked into "find" and the "size" option. All the posters seemed to have missed one of the subtle points of my post.

This is the partition scheme:

/dev/sda1 /boot
/dev/sda2 /
/dev/sda5 /home

So if I am searching / then I end up searching everything. I was interested to find if I could narrow the search to a particular device, e.g. the partition /.

Anyhow I am probably going to boot with Knoppix dvd or similiar and only mount the /dev/sda2 and search that.

Anyhow I'll test on monday and post back.

Thanks,

Stvy
 
Old 01-12-2008, 06:24 PM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,131

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Quote:
Originally Posted by stvy View Post
All the posters seemed to have missed one of the subtle points of my post.
...

So if I am searching / then I end up searching everything. I was interested to find if I could narrow the search to a particular device, e.g. the partition /.
Re-read post #4.
 
Old 01-12-2008, 09:04 PM   #12
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Also, if you are sure it is a large file, and you want to use find, use the "-xdev" or "-mount" options (they both do the same thing).

HTH

Forrest
 
Old 01-14-2008, 05:30 AM   #13
stvy
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Hi,

Thanks to all the posters. By following the advice in step 4 ( sorry I missed that advice first time I looked), I have found the problem.

One of the applications running on this host is using a postgreSQL database. It seems that it was incorrectly installed by the vendor, and the default location to log the data to was used. THe offending data was in /var/lib/pgsql/. I have a dedicated device (sdb1) which is supposed to have all this data goto.

Thanks to all the replies in this thread. I have learned a lot, and also solved the problem.

I will do some searching of the linuxquestiosn archive to read up on recommended partitioning schemes. I do not think my scheme is optimal. Especially considering this case.

Thanks,

Stvy
 
Old 01-15-2008, 02:15 AM   #14
stvy
LQ Newbie
 
Registered: Mar 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Hi,

Thanks to all the posters. By following the advice in step 4 ( sorry I missed that advice first time I looked), I have found the problem.

One of the applications running on this host is using a postgreSQL database. It seems that it was incorrectly installed by the vendor, and the default location to log the data to was used. THe offending data was in /var/lib/pgsql/. I have a dedicated device (sdb1) which is supposed to have all this data goto.

Thanks to all the replies in this thread. I have learned a lot, and also solved the problem.

I will do some searching of the linuxquestiosn archive to read up on recommended partitioning schemes. I do not think my scheme is optimal. Especially considering this case.

Thanks,

Stvy


EDIT: I realise the actually I was not looking for a single large file. In fact postgres works with a number of smaller files. Oh well. Live and learn.... Thanks again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Locating Files and File Sizes on Servers? carlosinfl Linux - Server 5 04-23-2007 04:22 PM
partition full, good methods for hunting down large files? laggerific Linux - Software 2 06-06-2006 12:00 PM
Locating Installed Programs /or Files Mr T Donegal Linux - Software 5 06-28-2004 08:36 PM
Locating GTK files so that I can compile a program Bob Moore Linux - General 0 06-24-2004 09:03 AM
Partition shows 99% full even after deleting large files other1 Linux - Newbie 4 04-19-2004 11:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration