error “No free space left on the device” on Linux devices
December 5, 2022
How to fix the error in Linux?
One of the main reasons many users choose Linux as their primary operating system is the consistency of error messages. Whether you are running a command to install an application package or trying to change something in the operating system environment, computer errors can occur. Using a Linux operating system ensures that you always identify the correctable cause of such errors.
However, not all errors are simple. Some require technical skills to fix. In this article, we will talk about the “No free space on device” error and discuss the solution that can fix it in Linux. We will encounter this error even if we are sure that our Linux system has enough disk space.
What does the error “No free space left on the device” mean?
Linux is usually very specific in its error messages. But if it’s a message that the device has no space, the system doesn’t tell you where most of the files are and what to do with them.
You just get a notification that you have no space. It often happens that you had a lot of space and suddenly it’s gone. The reasons for this can vary from the fact that you have used up all the free space yourself to the fact that it could be a system error in your Linux system.
No space on the device Possible causes
Check the remaining space on the device
Before proceeding, it is a good idea to check if you have any disk space left. While the tools in your desktop environment are convenient, it may be faster to use the tools directly from the command line.
If you want to use the tools in your desktop environment, they give you an easy-to-read view of the information you can get with these tools. I am using Fedora with GNOME and the GNOME Disk Usage Analyzer tool shows the following.
File systems can become corrupted over time and drives can fail. Your operating system can recognize these blocks as usable unless otherwise specified. The best way to find and mark these blocks is to use fsck and the -cc flag. Remember that you cannot fsck from the same file system you are trying, so you will probably have to use a live CD.
Obviously, replace the drive space with the drive you want to scan. You can find this using the df command above. Also, note that this can be time-consuming.
Deleted file reserved
Sometimes the file has been deleted but the process is still using it. Linux does not release the security associated with the file while the process is running, but you can restore the process with a reboot.
- Try to locate the process.
sudo lsof / | grep deleted
- The problematic process should be listed. Simply restart it.
sudo systemctl restart service_name
- If it is not immediately obvious, perform a full daemon-reload.
sudo systemctl daemon-reload
Not enough inodes
File systems contain a set of metadata called “inodes”. Inodes store information about files. Most files have a fixed number of inodes, so it is possible to fill a maximum allocation of inodes without filling the file itself.
In case you don’t know they are inodes a data structure that stores all files and directories in a Linux or UNIX-based file system. Thus, each file and directory in the file system is assigned an inode, known by a number known as a “node number”.
Note: This problem is not exactly easy to diagnose in all cases. However, with a little luck, you can clear it up and get your system back to normal operation.