DB / Linux / ENOSPC (Error 28)
CRITICAL

Linux No Space Left on Device

The 'No space left on device' error occurs when a filesystem cannot allocate space for new data. This can happen due to exhausted disk space, inode limits, or filesystem quota restrictions.

Common Causes

  • Physical disk space exhaustion (100% usage)
  • Inode exhaustion (filesystem metadata limit reached)
  • Filesystem quota limits for users/groups
  • Docker container storage limits
  • Temporary directory (/tmp) filling up

How to Fix

1 Check Disk Usage

Use df command to identify which filesystem is full and how much space is available.

BASH
$ df -h

2 Check Inode Usage

Verify if the error is caused by inode exhaustion rather than disk space.

BASH
$ df -i

3 Find Large Files/Directories

Identify what's consuming the most space in the affected filesystem.

BASH
$ du -sh /* 2>/dev/null | sort -rh | head -20

4 Clean Temporary Files

Remove temporary files and clear package manager caches to free up space.

BASH
$ sudo apt-get clean # Debian/Ubuntu # OR sudo yum clean all # RHEL/CentOS

5 Check and Clear Old Logs

Remove or rotate old log files that may be consuming significant space.

BASH
$ sudo journalctl --vacuum-time=7d # Keep only last 7 days of logs # OR find and remove old logs find /var/log -name "*.log" -type f -mtime +30 -delete

6 Resize Filesystem (LVM)

If using LVM, extend the logical volume and filesystem to add more space.

BASH
$ # Extend logical volume sudo lvextend -L +10G /dev/vgname/lvname # Resize filesystem sudo resize2fs /dev/vgname/lvname # For ext2/3/4