Skip to content

Linux no space left on device: 3 Fixes

More often than not, Linux is pretty specific with its error messages and codes. However, there are a few errors that can dazzle even the most seasoned terminal pros.

In this article, we’re going over a few fixes you can try out if Linux tells you there’s no space left on the device.

Also read: How to open task manager in Linux?


Check your harddisk

The first thing you should do is check if there’s space left on the drive you’re using. You can do this by either using a desktop-environment tool like GPARTED or GNOME Disk Usage Analyser depending upon the distro you’re using or use terminal tools.

Since terminal tools remain constant across distros, we’ll be going forward with those.

Step 1: Start with the du command and point to the root directory of the drive.

sudo du -sh /
Linux no space left on device: 3 Fixes | Candid.Technology

The command will go through all directories and list out total storage.

Step 2: Next up, try df with the same parameters.

sudo df -h
Linux no space left on device: 3 Fixes | Candid.Technology

The total file size should be close to what you got with df. If it’s not, then a process on your machine is using a deleted file which is hogging up your storage.

Also read: RM command in Linux explained with examples


How to fix this issue?

If you don’t see a discrepancy in the df and du commands above, head over to the second solution; otherwise, start with the first.

A process is blocking a deleted file

If a file is deleted, but a process is still using it, Linux won’t actually delete it, meaning the storage associated with the file is still occupied. Here’s how to fix this.

Step 1: Locate the process using the grep command.

sudo lsof / | grep deleted
Linux no space left on device: 3 Fixes | Candid.Technology

Step 2: Restart the process with the systemctl command. 

sudo systemctl restart service_name
Linux no space left on device: 3 Fixes | Candid.Technology

If that doesn’t work, do an entire daemon-reload.

sudo systemctl daemon-reload

System running out of Inodes

Inodes are metadata for filesystems and track information about files. Unfortunately, a bunch of file systems use a fixed number of inodes, making it a genuine possibility that you’ll run out of inodes before you run out of storage on your actual drive. You can use the following command to check for inodes.

sudo df -i /
Linux no space left on device: 3 Fixes | Candid.Technology

If you don’t see any free inodes, delete some old files from your drive to clear up a few inodes.


Bad Sectors

Bad sectors are an inherent problem of hard disk drives and can cause a lot of headaches. Over time, filesystems can become corrupt, and hard disks can die. As this process happens, the actual storage on your hard disk keeps shrinking a little.

You can find and mark bad sectors (or blocks) using the fsck tool.

sudo fsck -vcck /dev/sda2
Linux no space left on device: 3 Fixes | Candid.Technology

Just be sure to replace the drive name in the command above with the one you need to search. 

Also read: How to add a user to a group in Linux?

Hello There!

If you like what you read, please support our publication by sharing it with your friends, family and colleagues. If you're running an Adblocker, we humbly request you to whitelist us.

Share on facebook
Share on whatsapp
Share on twitter
Share on reddit
Share on linkedin
Share on pocket
Share on pinterest
Share on telegram
Share on stumbleupon
Share on digg
Share on tumblr
Share on email
Share on skype
Share on xing
Share on vk
Share on odnoklassniki
Share on mix








>