mysql_ufs_snapshot

Bourne shell script for FreeBSD servers that use MySQL and the UFS2 filesystem.

Description: 
1. Unmounts and deletes old snapshot if found.
2. The mysql(1) monitor is used to flush & lock the database
3. Using MySQL's SYSTEM(), to generate new snapshot using mksnap_ffs(8)
4. Mount resulting snapshot read-only to make it available for external backup.

It's meant to be used with cron(8) as a way to do make daily MySQL snapshots.
Also worth noting, other than the mysql monitor, it only depends on the 
FreeBSD base system.

It has only been tested on FreeBSD. If you make changes to get it
working on other 4.4BSD systems that support UFS2, feel free to send any 
enhancements.

Sample outputs:

# mysql_ufs_snapshot.sh -h
usage: mysql_ufs_snapshot [-h]
Description: Creates UFS2 snapshot of MySQL data directory
Then mounts the snapshot for further backup operations
Dependencies:
Deps: mksnap_ffs(8), mount(8), mdconfig(8), mysql(1), rm(1), awk(1)

# mysql_ufs_snapshot.sh
-> mysql_ufs_snapshot v2 starting

-> Old snapshot found
-> Detaching memory disk
-> Deleting old snapshot
-> Old snapshot deleted, continuing.. 
-> 
-> Launching mysql(1) monitor to lock tables and generate snapshot... 
-> done
-> Attaching snapshot to memory disk
-> Snapshot mounted at /mnt/mysql_snapshot
#

Icon  Name                       Last modified      Size  Description
[DIR] Parent Directory - [TXT] mysql_ufs_snapshot.sh.html 12-Oct-2010 13:55 11K [   ] mysql_ufs_snapshot.sh 26-Nov-2007 16:35 4.8K