﻿# 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.

Source: https://laszlonemes.com/university/computer-systems/disk-quota · Author: László Nemes

Troubleshooting · Computer Systems

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 read `Disk quota exceeded` `quota` `Hidden directories and du` `Cleaning ~/.cache` `Text 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.

> **Fig. 1** · Symptom → check → find → delete → check again.
>
> *Diagram:* The fix in five steps: when files can't be created, check the quota, list the biggest directories in your home including hidden ones, look inside the cache directory, delete the cache that is safe to delete, and check the quota 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

```text
Disk quotas for user abc123 (uid 12345): none
Volume Name                  Quota       Used  %Used   Partition
user.abc123                 512000     512136  100%<<       44%    <<WARNING
```

| Column | Meaning |
| --- | --- |
| `Quota` | The space you have, in KB – 512000 KB is about 500 MB. |
| `Used` | The space you currently use. |
| `%Used` | At `100%` nothing more can be written. `<<` marks the problem. |

what a full quota looks like in the shell

```text
$ 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.

> **Fig. 2** · A typical full home directory: the visible part is tiny, the hidden part is everything.
>
> *Diagram:* An example home directory close to a 500 MB quota. The hidden cache directory alone takes about 430 MB and the VS Code server another 58 MB, while the visible directories with your own work are only a few megabytes. ls and du -hsc * show only the visible ones.

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

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

example output

```text
431	./.cache
58	./.vscode-server
5	./.local
2	./Exercise_6
1	./scripts
```

| Part | What it does |
| --- | --- |
| `find .` | Start in the current directory (your home, after cd ~). |
| `-mindepth 1 -maxdepth 1` | Only the entries directly in it: not `.` itself, not deeper. |
| `-type d` | Directories only. |
| `-exec du -sm {} +` | Run `du` on them: `-s` one total per directory, `-m` in MB. |
| `sort -nr` | Sort numerically, largest first. |

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

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

Good to know

**Why .[!.]* and not .***

`.*` also matches `..`, the parent directory – `du` would then measure far more than your home. `.[!.]*` means "a dot, then anything but a dot, then anything".

## 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:

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

Then delete the large directories, for example:

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

or the whole content of the cache at once:

```shell
rm -rf ~/.cache/*
```

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

Common mistake

**rm -rf does not ask and cannot be undone**

There is no recycle bin in the shell. Before you press Enter, read the path once more – a space in the wrong place (`rm -rf ~/ .cache`) deletes your entire home directory. If unsure, list the path first, then delete exactly that. Never delete your own work – scripts, assignments – to make room.

```shell
ls -d ~/.cache/google-chrome     # does the path exist, and is it the one you mean?
rm -rf ~/.cache/google-chrome
```

### Other common space users

| Directory | What is in it | Safe to delete? |
| --- | --- | --- |
| `~/.cache` | Caches of browsers, Teams, VS Code | Yes |
| `~/.vscode-server` | The server-side part of VS Code Remote-SSH | Yes – it is reinstalled on your next connection |
| `~/.local/share/Trash` | The graphical desktop's recycle bin | Yes – 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

```shell
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
```
