Howto free disk space
These are some tips in addressing the dreadful recurring problem:
the hard disk is full, and I need a way
to understand which files to delete and to make space.
Find large files
It is quite useless to wander randomly around the directory tree and delete
some files that alltogether free some few meager megabytes;
it would be better to understand who is sucking our precious gigabytes
all at once.
This command is your friend, type it in a terminal:
# du -x /the/path | sort -nr | less -S
it will list the directories inside /the/path
in decreasing order of aggregate
disk usage. (For your home directory, use ~/ as
/the/path).
"Aggregate" means that, for each directory, the number
reflects the space used by all files and subdirectories therein contained.
Similarly the command
# du -xS /the/path | sort -nr | less -S
lists directories sizes (that is, the total size of files contained
in each directory)
without summing in the sizes of subdirectories.
Look into the list, (scroll it with arrow keys, hit "q" to exit);
the above listings may highlight that there are some old files
that you downloaded long ago (say, an Ubuntu iso image...) and
that you can delete right away.
Freeing space in the home account
In particular, for the home filesystem, there are some things
that you may delete right away:
- empty the trash bin.
- You may delete and disable the
urlclassifier2.sqlite and/or
urlclassifier3.sqlite Firefox file
(usually 40MB, you can live without: instant success!).
- You may delete caches: inside your home directory, you can wipeout
the directory .cache and all its subdirs,
(but you must close all the related applications before doing that! list the
contents of that directory to see the applications that are storing
data there, e.g. using
# dd -s ~/.cache/*
).
- Similarly the Firefox cache, that is inside
.mozilla/firefox/*/Cache (where '*' must be substituted
by a strange directory name, that is chosen at random
[why? beats me!]).
- Then there is the .thumbnails directory, that contains
thumbnails of files, and is used by Nautilus (it can grow quite
large and
you can tell Nautilus to keep it smaller)
The above methods may give back some hundreds megabytes.
Reduce reserved block count
Modern filesystems reserve a part of the disk space for the superuser.
While this is a good idea for the root filesystem,
it quite useless for data-only filesystems. So if you have such filesystems,
(e.g. if your /home directory tree is all
in its own partition - and I would always recommend that),
you can use that extra space by setting the reserved number of blocks
to 0.
For ext2 ext3 and ext4 filesystem types, the command
# tune2fs -r 0 /dev/----
achieves the feat (substitute /dev/---- by the correct device ;
you can use mount to find out).
Freeing space in the root filesystem
In Debian/Ubuntu, there are some specific methods.