Purge Binary Logs fails on full hard drive

The purge binary command fails – no logs are deleted and the process hangs:


mysql> PURGE BINARY LOGS TO 'BINLOG.000100';

Checking the error log:

ERROR 3 (HY000): Error writing file './mysql-bin.~rec~' (Errcode: 28)

The PURGE BINARY LOGS command requires free space to be able to clear the logs, which is why this command was failing. To be able to run the command please to stop MySQL, zero the first binary log and also remove it from the mysql-bin.index file. Restart MySQL, run the command:


PURGE BINARY LOGS TO 'BINLOG.000xxx';

If you get this error


ERROR 1373 (HY000): Target log not found in binlog index

Check the date. Since the binary log was from September 4th, ran the following:


PURGE BINARY LOGS BEFORE '2014-09-04';

Now the log files up to that date will be purged. If you are not using replication, you can most likely disable the binary logging unless you have this enabled for easier data recovery.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.