You’re trying to do something on INS (edit a file, compile, git commit, push, etc) and you’re get the following message:
Error <doing some action>: Disk quota exceeded
What should you do?
Determining the cause
There are two ways the quota can be exceeded:
- Too many files
- Total file size is too big
To figure out which one is causing your problem, run the following:
quota -s
This will produce something like:
For each of the two highlighted boxes, compare the number on the left to the number on the right. If the number on the left (your actual usage) is close to or greater than the number on the right (your quota), that’s your problem. In this example, the total file size is the issue.
Total file size
If the total file size is the issue, you need to delete some files. You can use the following command to list all files in your home directory, sorted by size:
du -ah ~ | sort -h
In my test student’s example, the output ends in:
17M /users/tstud789/.cache/some_file_0
26M /users/tstud789/.cache/some_file
42M /users/tstud789/.cache
43M /users/tstud789
This is showing that my total home directory is using 43M of space, and the .cache
directory is using 42M of that because of two large files.
Some common large files/directories that are safe to delete are:
~/.cache
: this is where a lot of temporary files are stored~/.vscode-server
: if you tried connecting VS Code to INS, you will almost certainly exceed your quota- Anything ending in
.gch
: this means you accidentally rang++
on a header file, which creates a large binary file
To delete a single file, use the following command:
rm <filename>
To delete a directory and all its contents, use the following command:
rm -rf <directory>
For example, to delete the .cache
directory, you would run:
rm -rf ~/.cache
WARNING: Be very careful with the
rm -rf
command. It will delete everything in the directory you specify, including subdirectories. It will not put things in the trash/recycle bin, they will simply be gone.
Too many files
This one’s a bit trickier, and it’s typically caused by git creating a bunch of small files. There are a few things you can do:
Run garbage collection on your git repositories, particularly
labs
. This will mash a bunch of small files into a single larger blob.cd
into the repository and run:git gc
Delete intermediate build files and emacs backup files. These are typically files that end in
~
or.o
. You can use thefind
command to do this:find ~ -name "*~" -delete find ~ -name "*.o" -delete
Check if you have any duplicate copies of labs or assignments, and delete the extras (make sure you know which one is the “good” copy!).
Finally, if you’re still having issues after doing steps 1-3, you can zip up some of your old assignments to store them as a single file. For example, to create a zip file of
a1
, you would run:zip -r a1.zip a1
You can then delete the
a1
directory, and if you ever need it again, you can unzip thea1.zip
file.