How to Fix the “No Space Left on Device” Error on Linux

No Space On Device Feature

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.

No Space On Device Disk Analyzer

Begin with du. Point it to the base directory on the drive that’s having the problem. Let’s assume it’s the partition with /.

No Space On Device Du

It’ll take some time to go through everything. Now, try with df.

No Space On Device Df

Add / 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 du and 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.

No Space On Device Lsof Deleted

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.

No Space On Device Inodes

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.

Bad Blocks

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.

If you’re looking for more Linux pointers, see our guide on how to set up Bluetooth in Linux. Or, for something a little different, see how to install Mac’s Safari browser in Linux. Enjoy!

John Perkins John Perkins

John is a young technical professional with a passion for educating users on the best ways to use their technology. He holds technical certifications covering topics ranging from computer hardware to cybersecurity to Linux system administration.


  1. Hi

    You forgot a little annoying detail…
    In the (real) case of “No space left on device”, you won’t be able to log or even start your system !!

    Prepare a live system key !!

    1. Actually it depends. I have been copying files when it gave me the warning and was able to delete thing. I have also been able to log in in recovery mode to fix the problem when I was unable to log in regularly. You could also run a USB drive with an OS and then copy and delete enough data to get a regular login. Still I think your suggestion is a good idea.

  2. I haven’t had that kind of warning, but I do have a Conky readout of system details which includes storage space occupied & free. Running down the right hand side of the screen, it gives instant info at a glance.

  3. You forgot a little annoying detail…
    In the (real) case of “No space left on device”, you won’t be able to log or even start your system !!

    I have this situation. when I try to enter using my Sysadmin and password the error flashes so fast I could only capture it with a video. Annoyingly everywhere it is assumed you have access but without being able to log in you can do nothing. my system is Red Hat and no idea how to create or find a boot disk to allow me to at least get to the point where I can find files to delete.
    Any assistance would be appreciated.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.