Help! I'm over my disk quota!

This page provides some information on tools and utilities that are available for you to use to investigate your disk usage, and provides some guidance on how to clear up space and apply for more disk quota.

Identifying the source of the disk usage:

Analysing usage on the command line:

The easiest way to find out how much disk space files and directories are using is to log into linux and do:

  du ~ -m --max-depth=1 | sort -n

This gives you this disk usage (du) of your home directory (~) in megabytes (-m), to a depth of 1 (--max-depth=1), passed (|) to a sort tool (sort) which will sort the output in numberical order(-n).

It should produce an output like:

  1       /home/students/<username>/.matlab
  1       /home/students/<username>/.ssh
  1       /home/students/<username>/.vim
  14      /home/students/<username>/.emacs.d
  98      /home/students/<username>/.eclipse
  105     /home/students/<username>/Downloads
  248     /home/students/<username>/work
  454     /home/students/<username> 

What this tells us is that the files in the directory work total 248MB, in Downloads total 105MB etc. It also shows us that the total disk usage of your home directory is 454MB.

To show the contents of a different directory, such as ~/work, simply replace the ~ in the above command with the desired directory, i.e:

  du ~/work -m --max-depth=1 | sort -n

Analysing usage with a gui:

Gnome ships with a tool called 'Disk Usage Analyser'. To run it, open a terminal and type:

  baobab &

This tool displays various graphical representations of the disk space used by files and directories. You can use it to determine the usage for each directory tree in your home directory.

Screenshot of the Disk Usage Analyser tool

Cleaning up

WARNING: Do not be tempted to delete files that start with a dot ('.') just because you do not know what they are. These are often important files, and deleting them can cause problems.

Common offenders

The following is a list of directories which often grow very large, and the implications of deleting them.

Directory Implication
~/.eclipse Any Eclipse settings you have altered (such as layout, fonts etc) will be deleted.
~/.netbeans Any Netbeans settings you have altered (such as layout, fonts etc) will be deleted.
~/.cabal Any Haskell libraries you have installed using cabal-install will be deleted.
~/.opam Any OCaml libraries you have installed using opam will be deleted.

Compressing files

To compress a single file, simply run:

  gzip myfile

This will compress the file and rename it to myfile.gz. To decompress the file, run:

  gunzip myfile.gz

This will decompress it, and rename it back to myfile. Files compressed with gzip can also be uncompressed with 7-Zip. Text files, especially postscript, can be drastically reduced in size using gzip.

Note that files cannot normally be read from or written to whilst gzipped.

To compress a whole directory, simply run:

  tar -zcvf mydir.tar.gz mydir

where mydir is the directory to compress. Unlike gzipping, this will not remove the original directory, so once you have checked the contents of the tarball:

  tar -ztvf mydir.tar.gz

you can delete the original directory.

To decompress the tarball, run:

  tar -zxvf mydir.tar.gz

As with single gzipped files, compressed tarballs cannot normally be read from or written to, so do not be tempted to tar and compress .eclipse, .cabal etc. to save space.

Increasing your disk quota

Once you have cleaned up as much as possible, if you find that you are still short of space for your work, then you can apply for more disk quota to be allocated by contacting the IT Service Desk https://universityofbirmingham.service-now.com/ and giving us an estimate of how much more you will need in order to accomodate your work.