• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

What's eating my HDD space?

kornphlake

Golden Member
I've got a 40gb drive with ubuntu 8.04 desktop installed. The PC is configured as a content filter running dansguardian, squid, dhcp3, etc. I'm currently using about 37gb of the 40gb drive but I can't figure out what is using all the space, with the packages I have installed I think I should be using less than 20gb, I suspect there's a log file that isn't rotating properly but I have no idea really. I don't have any music, videos, photos, or other data files that could be taking up significant space. Is there some way to quickly find the biggest files or directories on the drive and work back from there?
 
The command du will show you the amount of space used. So for example you could go into the root directory and then run du * and it'll show you the space used by each thing in there. Now in practice you want to ignore proc and dev so you likely only really need

du -sh bin etc lib opt sbin tmp boot home usr root srv var mnt run sys

The -sh will just neaten up the output so its in MB's and GB's and not blocks. From there you can go look into the directories that are big. There are much more advanced things you can do with find, du, cut and sort to actually list the top files/directories but honestly you don't need anymore than good old du and a few minutes of time.
 
Ubuntu has a tool called Baobab that you can run to figure out your space usage. It should be listed under Applications->Disk Usage Analyzer.
 
My guess would also be issues with log files.

It's not such an issue on a 40 GB drive, but most Linux flavors, including Ubuntu, dedicate 5% of each file system to "reserved space" that is only writable to root. This is done to ensure that critical functions run by root can work even if something goes berserk and fills the disk (for instance, so that logging can still work and you can diagnose the problem) and also to aid in defragmentation. This can be adjusted with tune2fs; there's a how-to here: http://ubuntuhowtos.com/howtos/tune2fs_increase_available_space
 
I found a 26gb file in my home directory named sdb, the owner is Root. I think I accidentally cloned the harddrive in a folder instead of cloning it to another drive when I tried booting from the harddrive instead of booting from a live CD. I can change the owner of the file and delete it without causing any problem right?
 
if you do 'du' command, remember to use -x switch to it won't add another driver mounted in some subdirectory
 
Back
Top