Most of the time, Linux is pretty specific with its error messages. “This didn’t work – try installing this package.” However, there’s one in particular that really doesn’t help me very much: “No space left on device.” What causes that? I thought I had 2 TB of storage, how can it be full? Where do I start looking? Today, we’ll be walking you through all of that in our guide on how to fix the “No space left on device” error on Linux.
Check the Space Left on Device
Before you go any further, it’s a good idea to check that there really is space left on the disk. While the tools in your desktop environment are good, it can be faster to use the direct ones from the command line.
If you’d like to use the tools in your desktop environment, they’ll give you easy-to-read representations of the information you can find with these tools. I’m using Fedora with GNOME, and the GNOME Disk Usage Analyzer tool shows me the following.
du. Point it to the base directory on the drive that’s having the problem. Let’s assume it’s the partition with
It’ll take some time to go through everything. Now, try with
/ and the filesystems mounted under it. For example, if you have
/home on a separate drive, add that in with the reading for
/. The total should come out close to what you had with
du. If not, that might point toward a deleted file being used by a process.
Of course, the main concern here is whether or not the results of these commands come in under the size of the drive. If it did, there’s obviously something wrong.
No Space on Device Possible Causes
There are a couple of main causes here. If you saw a discrepancy between
df, you can jump down to the first option here. Otherwise, start at the second one.
Deleted File Reserved by Process
Occasionally, a file will be deleted, but a process is still using it. Linux won’t release the storage associated with the file while the process is still running, but you can find the process and restart it.
Try to locate the process.
The problematic process should be listed. Just restart it.
If it’s not immediately evident, do a full daemon reload.
Not Enough Inodes
There is a set of metadata on filesystems called “inodes.” Inodes track information about files. A lot of filesystems have a fixed amount of inodes, so it’s very possible to fill the max allocation of inodes without filling the filesystem itself. You can use
df to check.
Compare the inodes used with the total inodes. If there’s no more available, unfortunately, you can’t get more. Delete some useless or out-of-date files to clear up inodes.
The last common problem is bad filesystem blocks. Filesystems can become corrupt over time, and hard drives die. Your operating system will most likely see those blocks as usable unless they’re otherwise marked. The best way to find and mark those blocks is by using
fsck with the
-cc flag. Remember that you can’t use
fsck from the same filesystem that you’re testing, so you’ll probably need to use a live CD.
Obviously, replace the drive location with the drive that you want to check. You can find that by using the
df command from earlier. Also, keep in mind that this will probably take a long time, so be prepared to grab a coffee.
Hopefully, one of these solutions solved your problem. This issue isn’t exactly easy to diagnose in every instance. With any luck, though, you can get it cleared up and have your system working again normally.