I have this error when I compile a C program:
writing to /tmp/cc6sZ4kE.s: No space left on device
How do I fix this?
I have this error when I compile a C program:
writing to /tmp/cc6sZ4kE.s: No space left on device
How do I fix this?
“No space left on device” means that the disk is full. You need to make some space on the disk (partition) that contains /tmp
, or more precisely on the filesystem that contains /tmp
.
This has nothing to do with the content of the program (unless you managed to write a program that compiles to a multi-gigabyte binary).
Check where /tmp
is located and how much space there is:
df /tmp
If /tmp
is its own filesystem (it says /tmp
in the “Mounted on” column) then check where the space is being used:
du /tmp | sort -n
Look at the directories at the end of the list. To see the biggest files in a directory, run e.g.
ls -lrS /tmp
If /tmp
is on the root filesystem (it says /
in the “Mounted on” column in the output of df /tmp
) then you need to make some space on your disk. See How to understand what's taking up disk space?
/tmp
. – Kusalananda May 26 '17 at 07:26