Sobes.tech
Junior — Middle

What methods can be used to identify and fix the 'No space left on device' error on a Linux system?

sobes.tech AI

Answer from AI

The "No space left on device" error in Linux means that the partition where the writing occurs has run out of free space. To identify and fix the problem, you can perform the following steps:

  1. Check free space on disks:
df -h
  1. Check inode usage (if there is space but the error persists):
df -i
  1. Find large files and directories:
du -sh /* 2>/dev/null

or for a deeper search:

du -sh /var/* 2>/dev/null
  1. Clear temporary files:
rm -rf /tmp/*
  1. Delete or archive old logs:
rm /var/log/*.old
  1. Check processes that might be creating large files:
lsof +L1
  1. If the issue is with inodes, delete many small files:
find /path/to/dir -type f -delete

After freeing up space, the error should disappear.