# Postgres13.2 disk was full postgres: archiver failed

**URL:** <https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164>\
**Category:** PostgreSQL\
**Created:** [October 24, 2022, 4:06pm UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164 "2022-10-24T16:06:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumarduvvuri](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@kumarduvvuri](https://forums.percona.com/u/kumarduvvuri)\
**Post date:** [October 24, 2022, 4:06pm UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/1 "2022-10-24T16:06:34Z")

</div>

Disk was full .Space was added and started postgres. arching is struck and files are being retained in pg\_wal of primary and in pg\_wal/archive\_status .ready files are being retained We have streaming replication setup with replication slots . replication appears to be working fine  
ps -ef |grep post from primary

postgres 4241 4225 0 00:01:15 postgres: archiver failed on 000000020000001F00000033

SELECT \* FROM pg\_stat\_archive is not getting updated and struck on file last\_failed\_wal | 000000020000001F00000033  
How to resolve the issue  
Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![kumarduvvuri](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@kumarduvvuri](https://forums.percona.com/u/kumarduvvuri)\
**Post date:** [October 26, 2022, 9:02pm UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/2 "2022-10-26T21:02:19Z")

</div>

Is this the Proper forum to post this ?

---

<div class="post-metadata">

**Author:** ![Bhargav\_Kamineni](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/bhargav_kamineni/32/8015_2.png) [@Bhargav\_Kamineni](https://forums.percona.com/u/Bhargav_Kamineni)\
**Post date:** [November 2, 2022, 7:10am UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/3 "2022-11-02T07:10:14Z")

</div>

Hey Hi Kumar - Yes, it’s the correct forum.

is this still happening? if so can you check if the Postgres user has the correct permissions for the archive location?

---

<div class="post-metadata">

**Author:** ![Jobin\_Augustine](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jobin_augustine/32/1275_2.png) [@Jobin\_Augustine](https://forums.percona.com/u/Jobin_Augustine)\
**Post date:** [November 2, 2022, 8:42am UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/4 "2022-11-02T08:42:37Z")

</div>

Since the WAL archiving is failing, the WAL segments will be retained until it is fixed. Please check your archive\_command.

---

<div class="post-metadata">

**Author:** ![muhammad.usama](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@muhammad.usama](https://forums.percona.com/u/muhammad.usama)\
**Post date:** [November 2, 2022, 9:03am UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/5 "2022-11-02T09:03:39Z")

</div>

Along with the above, do verify the WAL file in question ‘000000020000001F00000033’ is present in the pg\_wal/ directory. As you mentioned the issue started to happen after disk got full, so most probable cause would be the postgresql was not able to save the WAL file and now the archiver requires that file along with the corresponding .ready file in pg\_wal/archive\_status to proceed further

---

<div class="post-metadata">

**Author:** ![kumarduvvuri](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@kumarduvvuri](https://forums.percona.com/u/kumarduvvuri)\
**Post date:** [November 2, 2022, 11:53am UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/6 "2022-11-02T11:53:41Z")

</div>

@muhammad.usama 000000020000001F00000033 file is in pg\_wal with 16MB size , pg\_archive folder with 14MB size . will renaming 000000020000001F00000033.ready to 000000020000001F00000033.read.bad archives remaining files from pg\_wal/archive\_statusl ? if we have 100GB files in pg\_wal do we need same freespae space in pgarchive . we have one mount point for all files .

---

<div class="post-metadata">

**Author:** ![Charly\_Batista](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/charly_batista/32/1242_2.png) [@Charly\_Batista](https://forums.percona.com/u/Charly_Batista)\
**Post date:** [November 2, 2022, 1:25pm UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/7 "2022-11-02T13:25:17Z")

</div>

Hello @kumarduvvuri ,

You mention that you have replication slots and the replication seems to be working fine and only the archiving process is failing, right? In this case, the archive command you are using is returning an error to Postgres.

What is the archive command you are using? Are you using plain bash commands or any tool? Could you paste it here?

For example, if you are using a “cp” command and the file already exists it may fail to copy the file again.

---

<div class="post-metadata">

**Author:** ![kumarduvvuri](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@kumarduvvuri](https://forums.percona.com/u/kumarduvvuri)\
**Post date:** [November 2, 2022, 1:59pm UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/8 "2022-11-02T13:59:02Z")

</div>

cp command in postgressql.conf  
the below from logfile  
[4241] DETAIL: The failed archive command was: test ! -f /local/pgsql/13.2/pgbackup/pgarchive/000000020000001F00000033 && cp pg\_wal/000000020000001F00000033 /local/pgsql/13.2/pgbackup/pgarchive/000000020000001F00000033  
[4241] WARNING: archiving write-ahead log file “000000020000001F00000033” failed too many times, will try again later

file exists with 16MB in pg\_wal  
pgdata]$ ls pg\_wal/000000020000001F00000033  
pg\_wal/000000020000001F00000033

file with 14MB exists in pgbackup/pgarchive  
pgdata]$ ls /local/pgsql/13.2/pgbackup/pgarchive/000000020000001F00000033  
/local/pgsql/13.2/pgbackup/pgarchive/000000020000001F00000033

.ready file exists in pg\_wal/archive\_status  
000000020000001F00000033.ready file exists in archive\_status

Does renaming partial 14MB file in /local/pgsql/13.2/pgbackup/pgarchive/ resolves the issues ?

---

<div class="post-metadata">

**Author:** ![Charly\_Batista](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/charly_batista/32/1242_2.png) [@Charly\_Batista](https://forums.percona.com/u/Charly_Batista)\
**Post date:** [November 2, 2022, 2:06pm UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/9 "2022-11-02T14:06:22Z")

</div>

Hello @kumarduvvuri

The first part of your archive command checks if the files already exists in the destination folder:

> [@kumarduvvuri](#):
>
> test ! -f /local/pgsql/13.2/pgbackup/pgarchive/000000020000001F00000033 && cp pg\_wal/000000020000001F00000033 /local/pgsql/13.2/pgbackup/pgarchive/000000020000001F00000033

This test will fail because the file indeed exists in the folder `/local/pgsql/13.2/pgbackup/pgarchive/`. You can move the files “000000020000001F00000033” from the archive folder `/local/pgsql/13.2/pgbackup/pgarchive` to another folder (for example your /home folder) and it should solve this issue and let the archive command continue.

---

<div class="post-metadata">

**Author:** ![kumarduvvuri](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@kumarduvvuri](https://forums.percona.com/u/kumarduvvuri)\
**Post date:** [November 2, 2022, 5:17pm UTC](https://forums.percona.com/t/postgres13-2-disk-was-full-postgres-archiver-failed/18164/10 "2022-11-02T17:17:48Z")

</div>

@Charly_Batista renaming file /local/pgsql/13.2/p/000000020000001F00000033 fixed the issue in Lab environment . We require the same amount of free space in pgbackup/pgarchive as the pending files in pg\_wal .  
Noticed another thing as an option 2 if we donot have pg\_wal space  
a) after runign checkpoint few time on primary , used pg\_controldata -D /local/pgsql/13.2/pgdata  
b) clean up files before Latest checkpoint’s REDO WAL file from pg\_wal using pg\_archivecleanup -d /local/pgsql/13.2/pgdata/pg\_wal , leaving around 100 files before checkpoint  
c) noticed 100 files leftover before pg\_archivecleanup are not getting cleaned up , no issues with archiving new files

Thanks for helping
