mylvmbackup project is a Perl script for quickly creating backups of MySQL server's data files. To perform a backup, mylvmbackup obtains a read lock on all tables and flushes all server caches to disk, makes an LVM snapshot of the volume containing the MySQL data directory, and unlocks the tables again. The snapshot process takes only a small amount of time. When it is done, the server can continue normal operations, while the actual file backup proceeds.
The LVM snapshot is mounted to a temporary directory and all data is backed up using the tar program. The archive file is created using a name of the form backup-YYYYMMDD_hhmmss_mysql.tar.gz, where YYYY, MM, DD, hh, mm, and ss represent the year, month, day, hour, minute, and second of the time at which the backup occurred. The prefix backup and the date format can be modified. The use of timestamped archive names allows you to run mylvmbackup many times without danger of rewriting old archives.
It is necessary to run mylvmbackup on the same host where the MySQL server runs. If your MySQL daemon is not listening on localhost, or using the default socket location, you must specify --host or --socket. Even though mylvmbackup communicates with the server through a normal client connection to obtain the read lock and flush data, it makes the backup by accessing the file system directly. It is also necessary that the MySQL server data directory resides on an LVM volume. (It is, however, a good idea to do the LVM backup to a different partition than the one where the data directory resides. Otherwise, there is a good chance that LVM will run out of undo space for LVM snapshot maintenance and the backup will fail.)
The user who invokes mylvmbackup must have sufficient filesystem permissions to create the LVM snapshot and mount it. This includes read/write access to the backup directory.
For proper operation mylvmbackup requires that Perl as well as the DBI and DBD::mysql modules. In addition, it uses several other programs: /bin/date to construct the archive filename, tar to back up data, LVM utilities to create and remove the LVM snapshot, and the system utilities mount and umount.
What's New in This Release: [ read full changelog ]
· The precleanup.pm hook sample was deleted as it has potential to cause harm and is too specialized on a particular use case.
· Support was added for rsync via SSH.
· InnoDB recovery was fixed in case a relative path to the MySQL data directory is defined.
· The documentation of relpath in the man page was improved.