Context description

My Linux distribution contains redis-server 6.0.5. Redis is configured to use persistence AOF (Append Only File) and the RDB persistence is disabled.

At boot a script requests to redis-server the execution of BGREWRITEAOF command. This request starts a process (with PID=<pid>) which creates a file temp-rewriteaof-<pid>.aof in the same data Redis path where is written the appendonly.aof file.

This is the normal working of BGREWRITEAOF command. The usefulness of this command is proved by what it's written in this post.

What's the problem

The problem comes when the system is switch off while the BGREWRITEAOF is not completed. In this case the file temp-rewriteaof-<pid>.aof is still present at reboot and it takes up space on the disk.

Because the system can be switch off in every moment I risk that my disk can become full.
In my opinion, the unique solution for this problem is to create a script that remove all files temp-rewriteaof-*.aof from the data Redis folder.


Does someone know a better solution? Redis has got a clean procedure/command for solve this problem?

1 Answer 1


Redis-server does not have sophisticated methods of managing the disk space on the server where it's running. It manages its own RDB snapshot files and the AOF file (as you described). However, managing files that were created by a previous process interrupted by a computer halt is not something Redis does.

I would suggest you add a routine to the boot-time script you wrote that sends the BGREWRITEAOF command to the Redis server. The routine would clean out any stale temporary AOF file that was left behind by the previous server halt. It's a good place for this routine - the script is already concerned with AOF file management, and boot time is an appropriate time to prepare for the next hours/days of the computer running (and consuming disk space) by cleaning up stale files.

  • Thanks, you confirm exactly what I said in the question. I think that I can request the cleaning of the temp files before executing the command BGREWRITEAOF in this way the cleaning and the command not can be in conflict.
    – User051209
    Oct 28, 2022 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .