Something's filling up my disk, but I don't know what it is.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
It looks like I have 18GB of space and using most of it. I have no idea what it could be, since I have no videos or pictures on this system. I ran apt-get clean, apt-get autoclean as well. So I try ls, thinking I could see what directory is the huge one:
In general, I find my Ubuntu systems fill up with trash more than anything else. But this might just be me never quite adjusting to the fact that deleting something doesn't delete it... Look for a hidden directory .Trash1000 in the root of any volumes.
After that, my first ports of call would be /var/log and /home .
OT, but as per your signature, the following would be better phrased "to sort space usage in descending order", but more ideally would be "to sort files in descending order of disk space used" or "to sort files according to disk space used, in descending order".
Originally Posted by quanta
A beautiful command to sort space usage in decrease order:
Linux treats everything - including directories - as files. The 4096 you are seeing is the default directory size on disk. If the table of contents for the directory contents fits into the 4096 bytes (most do), then 4096 is what you will see. As the directory grows with more and more files, more and more space will be allocated for the TOC, and the size you see for the directory will grow.
From the command line, execute this command:
sudo find / -type d -size +100000c
This will search your hard drive for any directories whose file descriptor is over 100000 bytes (this would be a BIG directory with lots of files. Typically, /usr, /bin, and /lib will be that big. Also possibly /usr/lib or /usr/local/lib.
You may find something in /var/cache that is that big; if so take a look at it; nothing there should have that many files in it and if it does, you have found your problem.
Basically, look at any directory that is that big. Someplace, you just might find a directory that has a million files in it because a misconfiguration in, for instance, your mail daemon has caused an email to be generated every 60 seconds for the last two years but - because that email couldn't be sent due to a misconfig - those emails have accumulated for that entire time. This, BTW, is the exact situation I have encountered in the past...with over a million files in the directory.
Then, run this command:
sudo find / -type f -size +5000000c
This will identify all files on your drive that are over 5 million bytes in size. You are looking for log files or error files, or core dump files, or pretty much anything else. Check out all candidates, and respond appropriately. Often - usually - deleting is the thing to do. Pay particular attention to .xsession-errors that will exist in home directories; if you remain logged in for long periods, that file can get HUGE if you have some program running that likes to write to the log.
Play with the numbers and the file sizes you use for your thresholds. You'll find the problem; it is there someplace.
Just yesterday, I did this on my system drive and freed 1.7 Gigs on my system partition when I discovered some log files that were growing forever that I had not known about.
Also check if du and df give very different results. If so, there may be some open files, (such as logging scripts) that don't properly end.
For example, I used to run a cronjob with the swatch command (a perl script that monitors log files.) However, the old jobs wouldn't properly close, so if I did pgrep swatch (to see how many instances were running) there would only be one, but if I did pgrep perl there would be 10 instances (in a ten day period.)
lsof |(sed 1q; grep deleted)
will show files that might be held open by something or another, along with a PID number. Doing
ps -ef |grep <PID_number> will show what process is doing this.
It's a relatively uncommon situation, but a useful thing to check if du shows lots of space while df shows almost none.
Ahh, but I really needed my computer so as soon as I could do work again I forgot about further de-cruftifying. I have at least two years before I have to worry about it. I'll probably upgrade before then.
I had the same problem that was driving me mad. every time i'd clear more space on my drive i would come back the next day to see it full again.
Turns out it was my
files that grew to 142G
much of it was firefox warnings...
now i need to go back and find out what is wrong with firefox but at least my disk is free.