PromptHub
DevOps Error ENOSPC Beginner 14 views

Out of Disk Space

The system or application ran out of disk space.

Explanation

Out of Disk Space (ENOSPC) occurs when the filesystem has no more free space available. This affects any operation that tries to write data: file creation, log writing, database operations, package installation, and more. Common causes include log files growing unbounded, large file uploads not being cleaned up, database files expanding, Docker images accumulating, or node_modules growing too large. This is a critical system issue that can crash applications and databases.

Common Causes

  • Unbounded log file growth
  • Docker images accumulating
  • Large file uploads not cleaned
  • Database files expanding
  • Package cache growing

Solution

Check disk usage: df -h (Linux/Mac) or df -h (Git Bash on Windows). Find large files: du -sh /* | sort -rh | head -10. Clean up logs: truncate /var/log/app.log. Remove old Docker images: docker system prune. Clean package manager cache: npm cache clean --force. Remove unused dependencies. Set up log rotation. Configure Docker to use a different disk. Archive old data. Set up monitoring for disk usage alerts. Consider using cloud storage for large files.

Code Example

# Check disk usage
df -h
# Filesystem      Size  Used Avail Use% Mounted on
# /dev/sda1       50G   50G    0  100% /

# Find largest directories
du -sh /* 2>/dev/null | sort -rh | head -10

# Clean Docker
sudo docker system prune -a
sudo docker volume prune

# Clean npm cache
npm cache clean --force
sudo rm -rf node_modules && npm install

# Clean logs
sudo journalctl --vacuum-size=100M
sudo find /var/log -name '*.gz' -delete

# Truncate large log files
sudo truncate -s 0 /var/log/app.log

# Laravel specific
sudo rm -rf storage/logs/*
sudo rm -rf bootstrap/cache/*

# Set up log rotation
# /etc/logrotate.d/myapp
/var/log/myapp/*.log {
    daily
    rotate 7
    compress
    missingok
    notifempty
}

Error Information

Language

bash

Difficulty

Beginner

Views

14

Related Errors