I have a master mysql server which has approached 80% of the available disk space. Total disk space size is 200GB. Though, it's not an immediate concern but I have to deal with at some point soon. the data directory is mounted on to logical volume.

--- Logical volume ---
LV Path                /dev/mysql/data
LV Name                data
VG Name                mysql
LV UUID                UNse6Y-QgCX-Ap6D-UXvr-VXs5-r8dc-g91Vhn
LV Write Access        read/write
LV Creation host, time localhost, 2012-09-19 15:22:49 +0100
LV Status              available
# open                 2
LV Size                200.00 GiB
Current LE             51200
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:3

And this is mounted under /data directory.

/dev/mapper/mysql-data  /data                   reiserfs        defaults,noatime,nodiratime,notail,data=writeback 0 1

Unfortunately, the binary logs are located inside the the /data directory.

# grep -i log-bin /etc/my.cnf 
log-bin                 = /data/binlog/mysql-bin.log

I am looking for the best option to increase the disk space and or moving the binary logs to a separate disk location without having to restart mysql or with minimal downtime?

The database version is:

mysql> SHOW VARIABLES LIKE "%version%";
| Variable_name           | Value               |
| protocol_version        | 10                  |
| version                 | 5.1.61-log          |
| version_comment         | Source distribution |
| version_compile_machine | x86_64              |
| version_compile_os      | redhat-linux-gnu    |
5 rows in set (0.00 sec)

Is there any good solution? Please help.

  • Hi @jynus I have updated the original question with the database version now. The slaves update almost instantly and I don't really need to keep the old binary logs for too long ( a week is more than enough). The binary logs have a constant size and I do sometimes purge old binary logs.
    – mezi
    Oct 20, 2014 at 16:38

1 Answer 1


You say you have bin logging enabled. This leads me to believe you have replication running.

To minimize down time you could promote your slave to master. The finer details on how to do this really depends on your setup. Maybe it will involve updating application configurations, maybe it will involve changing the DNS to your "master server".

Prior to the promotion ensure you slave is configured they way you would like, e.g. not writing binlogs to the data directory. Make sure all the grants present on the master are on the slave. Make sure the slave is not running in read only mode when you are ready to bounce.

Prior to promotion you'll want to ensure both the master and slave are in read only mode. Run show master status; on the slave to see what log file and position you'll use for change master to after you reconfigure and restart the old master to run as a slave.

Once the old slave is promoted to the new master you can take your time to move the old binlogs to a new file system and reconfigure to keep new logs out of the data dir.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.