Troubleshooting · Computer Systems

Disk quota full on the course server

Cannot save or create files on the server? Check the quota, find the hidden directory that fills it – almost always ~/.cache – delete what is safe, and check again. Plus the fix for a failing graphical login on lab machines.

6 min readDisk quota exceededquotaHidden directories and duCleaning ~/.cacheText console login

Every user on the course server has a fixed amount of disk space, the quota – about 500 MB. When it is full, you cannot create or upload new files any more – and the space is usually taken by hidden directories, not by your own work.

You probably have this problem if:

  • your editor cannot save a file;
  • touch, mkdir, cp or an upload fail with Disk quota exceeded;
  • at login you see a quota table with 100% and <<WARNING;
  • on a lab machine, logging in to the graphical desktop fails.
The short version: run quota; if it says 100%, the space is almost always in the hidden ~/.cache directory. Delete what's inside it and run quota again. The steps below show how to check each part before you delete anything.
symptomtouch: cannot touch 'x': Disk quota exceeded1. check the quotaquota2. find what is bigfind . -mindepth 1 -maxdepth 1 -type d -exec du -sm {} + | sort -nr3. look inside .cachedu -hsc ~/.cache/*4. delete the cacherm -rf ~/.cache/<directory>5. check againquota – below 100%: done
Fig. 1 · Symptom → check → find → delete → check again.

Step 1: confirm it's the quota

The server prints your quota when you log in, and the quota command prints it again at any time:

quota – a full one

Disk quotas for user abc123 (uid 12345): none
Volume Name                  Quota       Used  %Used   Partition
user.abc123                 512000     512136  100%<<       44%    <<WARNING
ColumnMeaning
QuotaThe space you have, in KB – 512000 KB is about 500 MB.
UsedThe space you currently use.
%UsedAt 100% nothing more can be written. << marks the problem.

what a full quota looks like in the shell

$ touch notes.txt
touch: cannot touch 'notes.txt': Disk quota exceeded
$ mkdir exercise
mkdir: cannot create directory 'exercise': Disk quota exceeded

Step 2: find what is using the space

Run ls in your home directory and you'll see a few small folders – nothing that could fill 500 MB. That's the trap: the space is taken by hidden directories, whose names start with a dot. ls doesn't list them without -a, and du -hsc * doesn't count them either, because * doesn't match names starting with a dot.

directoryls shows it?size (MB, example).cacheno – hidden431.vscode-serverno – hidden58.localno – hidden5Exercise_6yes2scriptsyes1Your own work is the blue sliver. The space is in the directories that plain ls doesn't list.
Fig. 2 · A typical full home directory: the visible part is tiny, the hidden part is everything.

List every directory directly in your home – hidden ones included – with its size in MB, biggest first:

cd ~
find . -mindepth 1 -maxdepth 1 -type d -exec du -sm {} + | sort -nr

example output

431	./.cache
58	./.vscode-server
5	./.local
2	./Exercise_6
1	./scripts
PartWhat it does
find .Start in the current directory (your home, after cd ~).
-mindepth 1 -maxdepth 1Only the entries directly in it: not . itself, not deeper.
-type dDirectories only.
-exec du -sm {} +Run du on them: -s one total per directory, -m in MB.
sort -nrSort numerically, largest first.

Two shorter alternatives – you need both, because neither covers everything:

du -hsc *          # visible files and directories + total
du -hsc .[!.]*     # hidden ones (names starting with .) + total

Step 3: delete what is safe to delete

The usual culprit: ~/.cache

~/.cache fills up first. It holds caches – mostly of Chrome, Firefox, MS Teams and VS Code. Look at what is big inside it:

du -hsc ~/.cache/*
du -sm ~/.cache/* | sort -nr | head     # the same, biggest first

Then delete the large directories, for example:

rm -rf ~/.cache/google-chrome
rm -rf ~/.cache/mozilla

or the whole content of the cache at once:

rm -rf ~/.cache/*

Programs recreate their cache when they need it, so deleting ~/.cache loses no data.

Other common space users

DirectoryWhat is in itSafe to delete?
~/.cacheCaches of browsers, Teams, VS CodeYes
~/.vscode-serverThe server-side part of VS Code Remote-SSHYes – it is reinstalled on your next connection
~/.local/share/TrashThe graphical desktop's recycle binYes – this empties the bin for good

Step 4: check again

Run quota once more. Once %Used is below 100%, everything works again. If it's still full, go back to step 2 and look one level deeper into the biggest directory.

If you can't log in graphically on a lab machine

If your quota is full, logging in to the graphical desktop may also fail. Clean up from a text console instead:

  1. Press one of Ctrl + Alt + F1 … Ctrl + Alt + F6 to switch to a text console. On the lab machines only Ctrl + Alt + F1 and Ctrl + Alt + F6 work.
  2. Log in with your username and password.
  3. Free up space as in steps 1–4.
  4. Press Alt + F7 to switch back to the graphical screen – the login works now.

The same cleanup works on the faculty's other Linux machines too – pandora, opsys, the course server and the lab machines.

Keep it from happening again

  • Glance at the quota table when you log in. At 80–90% clean up now, not the night before a deadline.
  • Don't keep large downloads, archives or videos in your home on the server; it is for scripts and text files.

Quick reference

quota                                                                 # 1. is it the quota?
cd ~
find . -mindepth 1 -maxdepth 1 -type d -exec du -sm {} + | sort -nr   # 2. what is big?
du -hsc ~/.cache/*                                                    # 3. what is in the cache?
rm -rf ~/.cache/<directory>                                           # 4. delete the cache
quota                                                                 # 5. check again