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:
- Check free space on disks:
df -h
- Check inode usage (if there is space but the error persists):
df -i
- Find large files and directories:
du -sh /* 2>/dev/null
or for a deeper search:
du -sh /var/* 2>/dev/null
- Clear temporary files:
rm -rf /tmp/*
- Delete or archive old logs:
rm /var/log/*.old
- Check processes that might be creating large files:
lsof +L1
- 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.