Diagnostic Queries
Symptoms
PostgreSQL could not write a file because the filesystem is full. PostgreSQL raises SQLSTATE 53100 (disk_full).
- A write failed with “No space left on device”.
- Common when WAL, temp files, or the data directory fill the volume.
- Writes and checkpoints stall until space is freed.
What the server log shows
ERROR: could not write to file "base/16384/24576": No space left on device
Why PostgreSQL raises this — what the manual says
As Section 28.6 WAL Internals explains:
A write failed because the filesystem holding pg_wal or the data directory ran out of space; WAL must be written before transactions can commit, so the server stops accepting writes until space is freed.
PostgreSQL must write heap, index, WAL, and temp files to disk. When the underlying filesystem has no free space, writes fail and PostgreSQL reports 53100; a full WAL volume can halt the server entirely.
Common causes
- WAL accumulation (unconsumed replication slots, archiving lag).
- Large temporary files from heavy sorts/hashes.
- Bloat or unbounded data growth filling the data volume.
How to fix it
- Free space urgently (remove old logs/temp; extend the volume).
- Investigate WAL growth: stuck replication slots, failing
archive_command. - Add monitoring/alerts on disk usage; cap temp usage with
temp_file_limit.
Related & next steps
Reference: PostgreSQL 18 Section 30.5 “WAL Internals”.
Thanks — noted. This helps keep the database accurate.