> ## Content Index
> Fetch the complete content index at: https://til.codes/llms.txt
> Use this file to discover other available public pages before exploring further.

# Deleting stale Postgres wal files
- URL: https://til.codes/deleting-stale-postgres-wal-files/
- Published: 2020-10-27T22:48:22.000Z
- Updated: 2020-10-27T22:48:22.000Z
- Author: Manu Ajith
- Tags: postgresql, #Import 2024-07-13 21:01

I was debugging a system earlier today, where one of the postgres instances ran out of disk space, and taking a closer look at the system, I realised that the backup command was failing silently, but the postgres archive files was still being retained in the wal folder.

Checking a bit at the document, found that they can be deleted using:

```bash
pg_archivecleanup -d /var/lib/postgresql/wal/pg_wal 000000010000003700000010.00000020
```

Hope it helps someone or even me in future :)