Use it when the database disk is full or filling fast.
Disk Full on Database Servers
Disk full on a database server stops writes or the whole server. Common causes: data growth, WAL/binlog/transaction log not truncating, temp files, backups or logs on the same disk.
1. df -h — which filesystem?
2. Largest: data, WAL (pg_wal), binlogs, log files, temp, backups.
3. PG: archiver failures, inactive slots.
4. MySQL: PURGE BINARY LOGS after replicas/backups are safe.
5. SQL Server: log_reuse_wait_desc.
growth or retained logs → disk fills → cause fixed → space freed safely
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
After freeing space, confirm the database accepts writes and the growth cause is fixed. Alert before the disk is full.
Step 2 Common failures Narrow the fault
Deleting WAL or binlog files by hand can make the database unrecoverable. Restarting does not free space if the cause remains. Backups written to the data disk fill it.
Never delete WAL/log files by hand. Find why logs are retained (archiving failure, inactive slot, missing log backups). Free space safely, then fix the cause.
df -h— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
ReferenceWhat it is1 section · depth on demand
How it works
Logs grow when they cannot be recycled: missing log backups, stuck replication, failed archiving. Large sorts and hash joins spill to temporary files when memory is not enough.
ReferenceImportant terms & boundaries3 sections · depth on demand
Recovering from a full disk
1. Find what grew: data, logs (WAL/binlog/transaction log), temp files, backups, error logs.
2. Free space safely: purge old binlogs with PURGE BINARY LOGS, take a log backup in SQL Server, drop inactive replication slots in PostgreSQL — never delete WAL or log files by hand.
3. Extend the volume if needed.
4. Fix the cause: retention, monitoring, autovacuum, log backup jobs.
Alert at 80 % and 90 % for database volumes.
In depth
What happens when the disk fills
| Disk that fills | PostgreSQL | MySQL InnoDB | SQL Server |
|---|---|---|---|
| Data files | Writes fail with errors; existing data intact | Writes wait/fail (The table is full, error 28) | Error 1105 (filegroup full) |
| Transaction log | Server may PANIC and stop | Server stops writing | Error 9002 (log full) — database read-only for writes |
Find what grew, without deleting anything yet
df -h; du -xsh /var/lib/postgresql/*/main/{base,pg_wal} /var/lib/mysql/* 2>/dev/null | sort -h | tail
SELECT slot_name, active, wal_status FROM pg_replication_slots; -- stuck slot?
SELECT failed_count, last_failed_wal FROM pg_stat_archiver; -- failing archive?
SELECT datname, temp_bytes FROM pg_stat_database ORDER BY 2 DESC; -- temp files?
SHOW BINARY LOGS; -- MySQL binlog volume
SELECT name, log_reuse_wait_desc FROM sys.databases; -- SQL Server log
Safe ways to free space
| Cause | Safe action |
|---|---|
| Stuck PostgreSQL slot | Drop the slot if its consumer is gone: SELECT pg_drop_replication_slot('x'); |
| Failing WAL archive | Fix the archive target; PostgreSQL then archives and recycles WAL itself |
| Old MySQL binlogs | PURGE BINARY LOGS BEFORE '2026-11-20'; after checking replicas and PITR needs |
| SQL Server log | Take a log backup (FULL model) or fix what log_reuse_wait_desc names |
| Runaway temp files | Cancel the query creating them |
| Local backup files, server logs | Move or delete them |
Never delete files inside pg_wal, InnoDB redo/undo files or .ldf files by hand; the database cannot recover without them. As a reserve, keep a few gigabytes of placeholder file on the same filesystem that can be removed in an emergency, and alert well before the disk is full.
Common mistakes
- Deleting log files the database still needs (WAL/binlogs).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.