'ERROR 3 (HY000): Error writing file './binlog.index_crash_safe' (OS errno 28 - No space left on device)

I use mysql in docker and my server's space is 100% full.

Half of space is occupied by /var/lib/mysql/binlog.* files and I want to remove them with the following command:

purge binary logs to 'binlog.000142';

Error is:

ERROR 3 (HY000): Error writing file './binlog.index_crash_safe' (OS errno 28 - No space left on device)

As recommended in StackOverFlow by community in other questions, it's not recommended to remove rm binlog via the OS and it's better to remove by mysql query.

What should I do in this case? Should I add hard disk to my server? Or there's a way to remove that?



Solution 1:[1]

As I had no other choices, I removed some other files in the server (not related to mysql), so I freed about 4GB, then ran this query in mysql:

purge binary logs to 'binlog.000142';

It is safe to run this query and you can run with no fear.

Just note that running this query removes files older than `binlog.000142' (not this file itself):

binlog.000141
binlog.000140
.
.
.

It keeps binlog.000142, binlog.000143 and newer files.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Saeed