What's eating my HDD space?

kornphlake

Golden Member
Dec 30, 2003
1,567
9
81
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?
 

BrightCandle

Diamond Member
Mar 15, 2007
4,762
0
76
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.
 

LCTSI

Member
Aug 17, 2010
93
0
66
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.
 

Aluvus

Platinum Member
Apr 27, 2006
2,913
1
0
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
 

kornphlake

Golden Member
Dec 30, 2003
1,567
9
81
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?