Diagnostic Queries
Symptoms
PostgreSQL tried to read a data block but the file was shorter than expected (it read 0 of the requested bytes). This usually signals truncation or storage failure and raises SQLSTATE 58030 (io_error).
- The block PostgreSQL expects is beyond the end of the file.
- Often a sign of filesystem damage, truncation, or hardware faults.
- Reads of the affected relation fail.
What the server log shows
ERROR: could not read block 8423 in file "base/16384/24576": read only 0 of 8192 bytes
Why PostgreSQL raises this — what the manual says
As Section 30.2 Data Checksums explains:
A read returned fewer bytes than the expected block size (zero of the requested bytes), indicating the relation file is truncated or the underlying storage failed to return the page; this points to filesystem or hardware-level corruption.
PostgreSQL expects each relation file to contain whole 8 kB blocks. When a requested block lies past the actual end of the file (read returns 0 bytes), it cannot proceed and reports 58030, indicating storage-level damage or truncation.
Common causes
- Filesystem corruption or a truncated relation file.
- Failing disk, bad sectors, or storage-layer faults.
- An interrupted restore or a partially copied data directory.
How to fix it
- Stop and take a full backup of the data directory before anything else.
- Check OS/disk logs (SMART, dmesg) and the underlying storage health.
- Restore the affected relation/table from a known-good backup; consider PITR.
Related & next steps
Reference: PostgreSQL 18 Section 30.2 “Reliability”.
Thanks — noted. This helps keep the database accurate.