database
system_error
ai_generated
true
ERROR: archive command failed with exit code 1 DETAIL: The archive command was: cp %p /archive/%f
ID: database/postgres-wal-archive-failure
85%Fix Rate
85%Confidence
1Evidence
2023-06-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| PostgreSQL 14 | active | — | — | — |
| PostgreSQL 15 | active | — | — | — |
| PostgreSQL 16 | active | — | — | — |
Root Cause
PostgreSQL WAL archiving command fails due to insufficient disk space, permission issues, or incorrect archive destination path.
generic中文
PostgreSQL WAL归档命令因磁盘空间不足、权限问题或归档目标路径不正确而失败。
Official Documentation
https://www.postgresql.org/docs/16/continuous-archiving.htmlWorkarounds
-
90% success Check disk space on archive destination: df -h /archive; if full, free space or increase archive destination mount size.
Check disk space on archive destination: df -h /archive; if full, free space or increase archive destination mount size.
-
85% success Fix permissions on archive directory: chown -R postgres:postgres /archive; chmod 700 /archive;
Fix permissions on archive directory: chown -R postgres:postgres /archive; chmod 700 /archive;
-
95% success Test the archive command manually: sudo -u postgres cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/; then fix any errors.
Test the archive command manually: sudo -u postgres cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/; then fix any errors.
中文步骤
Check disk space on archive destination: df -h /archive; if full, free space or increase archive destination mount size.
Fix permissions on archive directory: chown -R postgres:postgres /archive; chmod 700 /archive;
Test the archive command manually: sudo -u postgres cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/; then fix any errors.
Dead Ends
Common approaches that don't work:
-
Increase wal_keep_segments to a very high value to avoid archiving
60% fail
This only delays the problem; WAL segments still accumulate and eventually fill pg_wal, causing PostgreSQL to crash.
-
Set archive_mode=off to disable archiving entirely
90% fail
Disabling archiving breaks point-in-time recovery and replication; not a viable fix for production systems that require backups.