AWSCritical
Fix: AWS RDS Storage Full — Database Unresponsive
Database queries timing out or failing
!Symptoms
- Database queries timing out or failing
- RDS console showing storage at 100%
- Error: 'could not extend file' or 'No space left on device'
- Application errors related to database writes failing
?Root Causes
- Storage auto-scaling not enabled or max limit reached
- Large transaction logs (WAL/binlog) not being purged
- Bloated tables from missing VACUUM (PostgreSQL) or OPTIMIZE (MySQL)
- Large temporary tables from inefficient queries
- Excessive snapshots or point-in-time recovery logs
#Diagnosis Steps
- 1Check storage: AWS Console → RDS → Instance → Storage section
- 2Check CloudWatch: `FreeStorageSpace` metric approaching zero
- 3For PostgreSQL: `SELECT pg_database_size(current_database());` and `SELECT pg_size_pretty(pg_total_relation_size(relid)) FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC LIMIT 10;`
- 4Check WAL size: `SELECT pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), '0/0'));`
- 5For MySQL: `SHOW TABLE STATUS;` and check Data_length + Index_length
>Fix
- 1Enable storage auto-scaling: `aws rds modify-db-instance --db-instance-identifier <id> --max-allocated-storage 500`
- 2Manually increase storage: `aws rds modify-db-instance --allocated-storage <new-size>` (one-way, cannot decrease)
- 3Run VACUUM FULL on bloated PostgreSQL tables
- 4Delete old snapshots if not needed for compliance
- 5Kill long-running queries generating temp tables: `SELECT pg_terminate_backend(pid)`
*Prevention
- Always enable storage auto-scaling with a sensible max limit
- Set CloudWatch alarms for FreeStorageSpace below 20%
- Schedule regular VACUUM/ANALYZE for PostgreSQL via pg_cron
- Monitor table bloat and set up automated cleanup
- Use RDS Performance Insights to catch queries generating excessive temp data
Related Error Messages
could not extend fileNo space left on deviceFATAL: could not write to filedisk full