If you use a PC you have quite a few options as to what operating system you want to use. The most popular choice is of course Windows.
But if you do not trust the system from Microsoft or want to pick up something with more functionality and for more complex and cricket tasks, then you can turn your attention to the various systems based on Linux.
These operating systems allow you to do almost anything. They are not limited in their functionality and if you are comfortable with them they are perfect for all your daily tasks.
They can be a good alternative to Windows as they are generally faster, don’t overload your PC and you don’t have to worry about security. But even these systems have their problems and bugs.
For example, Linux users often run into memory problems.
What does the error “No free space left on the device” mean
Usually, Linux is more specific in its error messages. But in the case of the message about running out of space on the device, the system does not tell you where the most files are and what you can do about it.
You just get a notification that you are out of space. It is often the case that you have a lot of space only recently and then suddenly run out of it.
The reasons for this can vary from noticing you have used up all the free space yourself to the fact that it may be a system error in your Linux system.
How to check disk space
The first thing you need to do is to check if you are really out of free disk space. Although the tools in the desktop environment are good, it may be faster to use direct tools from the command line.
You can start with the command du. Specify to it the base directory on the disk. For example, if your problem disk is a root partition:
sudo du -sh /
The system will take time to bypass the entire directory tree. Next, you should try df :
sudo df -h
Next, try adding “/” and then the file system that is mounted under it. The sum should be the same or close to what you saw with du. If not, it might mean that the deleted file is being used by some process.
Also make sure that the result of this command matches the size of your disk. If it does, there is obviously a problem.
How to remove files which are occupied by a process
If you see a discrepancy between du and df command output, this might help you. It sometimes happens on Linux that a file has already been deleted and the process is still using it.
In this case, Linux will not be able to free up the space it was occupying while the process is running. In this case, you just need to find the process and restart it. To do this you need the following commands
- sudo lsof / | grep deleted
- If you get no results, use {sudo lsof / | grep -i del}
- In the list you should see the process that caused the problem. Now you just need to restart it with {sudo systemctl restart SERVICE NAME}
What to do if you don’t have enough Inode
In modern Linus file systems, there is a term for “Inodes” – is a set of metadata on the filesystem. They are needed to keep track of file information. Most file systems have a fixed number of inodes, so it is very possible to occupy the maximum amount allocated without filling the file system itself. You can use the command df to check:
sudo df -i /
Next, you will need to compare the number of existing Inodes with the number of occupied Inodes. If you run out of free Inodes you can not get more and it means your disk space will be full.
To fix this, delete unnecessary or old files. This will help free up disk space and give you access to write new files to the disk
What to do if you have Bad Blocks
Another common problem is having bad blocks in your file system. Due to wear and tear on disks, it happens that file systems get corrupted.
Your system may see such blocks as usable if they are not marked as bad.
To find and mark such blocks use the fsck command with the -cc flag. Keep in mind that you cannot use fsck from the same filesystem you are testing. You will probably need to use the Live CD.
Use the command {sudo fsck -vcck /Disk NAME}
This may take a long time, as the system will need to check your entire disk.
One of these solutions should help you with disk space problems.
Also note that if you have a FAT file system, it does not support writing files larger than 4 GB and it will display a “No space left on device” error when writing such a large file.