Mark's Technomusings

Thoughts, notes, and ramblings on the technology Mark Cervarich deals with on a daily basis.

Mysql binary log maintenance

I’ve been noticing that my /usr partition has been slowly getting more and more full. I finally figured out why. I had enabled MySQL to create binary logs, and the log file was growing quite large:

[root@ns data]# ls -sh *bin*
4.0K ns-bin.001  920K ns-bin.004   12M ns-bin.007
4.0K ns-bin.002  4.0K ns-bin.005   69M ns-bin.008
644K ns-bin.003  4.0K ns-bin.006  4.0K ns-bin.index
[root@ns data]# mysqladmin flush-logs
[root@ns data]# ls -sh *bin*
4.0K ns-bin.001  920K ns-bin.004   12M ns-bin.007  4.0K ns-bin.index
4.0K ns-bin.002  4.0K ns-bin.005   69M ns-bin.008
644K ns-bin.003  4.0K ns-bin.006  4.0K ns-bin.009

As you can see, right now, the current logfile is ns-bin.008 and has a size of 69MB! After running mysqladmin flush-logs, there is now a new 4.0kb ns-bin.009 file….and the ns-bin.008 file is still there…but I can cancel it and free up 69MB of space.

Leave a Reply