11

Not to long ago I was using only 35% of my HD. Just recently it shot up to 54% and my diskspace is 16gb so that's more then 3gigs that have been taken.

From what I remember I failed to build mysql, I installed gitolite which required me to build git from source which had a tons of dependencies (I think it was for building docs, I think I saw latex and other packages but I was drowsy when I was installing). I suspect that is what is taking the diskspace.

Anyways so far I deleted source folders I know I had and ran these commands. What else can I do? (3gigs is mighty)

sudo apt-get autoclean
sudo deborphan | xargs sudo apt-get -y remove --purge

After doing the above i did ncdu and found that

  1. Git itself was actually using 502mb in 152 files all in '/usr/local/libexec/git-core'. Who knew. I found it strange that most of those files are 4.6mb each...

  2. MySql was taking up 1+gb in my /tmp folder

  3. I accidentally made a copy of my mono src folder which has two builds of mono and is 1.7gb together.

After deleting the copy of src and an extra mono build (thats 2.6gb together) + the mysql in my temp folder df now reports 28% instead of 54% which makes me feel a lot better.

I'm still surprised git uses 502mb. On windows it uses 57mb (thats about 10xless). And the equivalent folder (C:\Program Files (x86)\Git\libexec\git-core) has all those apps as shortcuts to git. and git is only 1.2mb (not 4.6). Also i checked if the linux git-core folder were all links, i know they arent softlinks (i used the cmd find . -maxdepth 1 -type l -print0 | xargs -0 ls -ld) I tried stat git, stat git-add and saw they had the same innode. So most of these files are hardlinks (i assume) of git. So git doesnt actually take up that amount of space.

1
  • @Jasper Loy: I would but i only have sh access to the machine.
    – user4482
    Jan 15, 2011 at 3:58

5 Answers 5

7

My two favorite tools are for finding and visualizing filesystem bloat are gdmap and fslint. Summarized from apt-cache:

apt-cache show gdmap
apt-cache show fslint

gdmap: "GdMap is a tool which allows to visualize disk space. Ever wondered why your hard disk is full or what directory and files take up most of the space? With GdMap these questions can be answered quickly. To display directory structures cushion treemaps are used which visualize a complete folder or even the whole hard drive with one picture."

fslint : "has an interface for uninstalling packages, and it can find things like: .

- Duplicate files
- Problematic filenames
- Temporary files
- Bad symlinks
- Empty directories
- Nonstripped binaries"

OK, and here's an ncurses based one, which will print hash marks to show relative size if you want it:

ncdu
Description: ncurses disk usage viewer
    Ncdu is a ncurses-based du viewer. It provides a fast and easy-to-use interface through famous du utility. It allows to browse through the directories and show
    percentages of disk usage with ncurses library.

And two more text-based applications from my system repos, which are more involved:

gt5
durep
3
  • apt-get install fslint got me fslint-gui and not fslint. Both of these require gui and i only have a shell access to the box. Do you have any other recommendations?
    – user4482
    Jan 14, 2011 at 23:57
  • fslint is actually a gui front-end to the fslint command line tools. On my system those are in /usr/share/fslint/fslint/ . Sounds like gdmap needs a curses or ascii-art-ified front end. :) There are some script elaborations of simply using 'du -sh *' out there. I use things like du -sh | grep [0-9][MG] as short cuts.
    – belacqua
    Jan 15, 2011 at 0:02
  • I added a description of ncdu in my original answer.
    – belacqua
    Jan 15, 2011 at 0:21
2

... failed to build mysql, [..] build git and dependencies...

Where did you run this? In your home directory from source using make? Remove the involved directories.

If you installed packages using apt-get (or synaptic which uses apt), the history is available at /var/log/apt. You can view it in a terminal with less:

less /var/log/apt/history.log

If you see entries like history.log.1.gz, you have to use zless since the files are compressed:

zless /var/log/apt/history.log.1.gz

Another big space eater are caches, especially apt. You can check the diskspace apt is using by running du -msh /var/cache/apt/archives. These files are used if you reinstall a program and can safely be removed:

sudo apt-get clean

The Ubuntu documentation has a (more complete) page on disk space, which can be found at https://help.ubuntu.com/community/RecoverLostDiskSpace.

3
  • No history but term.log. I see a lot of texlive. I see libboost-regex1.34.1, many -perl and this file is about 400 lines. The log starts yesterday when i started to install gitolite. Thats a lot of packages... maybe i should uninstall libs now that i dont need them anymore? anyways what am i suppose to be doing with the log file? I dont see the directory i installed from.
    – user4482
    Jan 14, 2011 at 22:09
  • The log files in /var/log/apt/ contains only changes in packages using apt-get. For dpkg, see /var/log/dpkg.log (this file is harder to read). Libraries with are not used by applications can be removed using sudo apt-get autoremove. Oh, I forgot another important thing for saving disk space.
    – Lekensteyn
    Jan 14, 2011 at 22:18
  • Added the sudo apt-get clean thing.
    – Lekensteyn
    Jan 14, 2011 at 22:25
2

BleachBit allows to delete different kind of unnecessary files (logs/translations/cache/etc). Available from repos, install with apt-get install blechbit or visit http://apt.ubuntu.com/p/bleachbit which will open the installer (based on gdeb?) .

http://bleachbit.sourceforge.net/

2

kdirstat is also very good for figuring out where all your hard drive space went and cleaning it up.

$ apt-cache search kdirstat
kdirstat - graphical disk usage display with cleanup facilities

Note that kdirstat is a KDE application and will install the KDE libraries, whereas gdmap (in another answer) will not.

You could also look at Baobab. Baobab aims to be similar, but is not as good as kdirstat or gdmap. Baobab seems to be a part of the standard gnome-utils...

$ apt-cache search baobab
gnome-utils - GNOME desktop utilities
1
  • Baobab doesn't remove anything. It just shows graphically what folders are using most of disk space.
    – papukaija
    Mar 16, 2011 at 2:46
0

From all sloution I tried the only one give real space claning is

apt-get remove --auto-remove  --purge  packagename

I just install packet size with depends are 32MB when I run apt-get remove --purge package apt-get show me only 3.5MB space will be freaed when i added --auto-remove all depends were removed and gain more space . Plus if still have trace of KDE not remove you can remov it with this command

 apt-get remove kdelibs-bin kdelibs5-data 

Last log file could become really annoying if you don't need them remove it .

cat /dev/null >  /var/log/auth.log  

rm /var/cache/apt/archives/*

You must log in to answer this question.