Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.....
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).
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 ).
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.
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.
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.
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.
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.
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 /.
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 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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.