for taking mysqlbackup using lvm snapshots:
we need to follow 5 steps are follows.
1. connect to mysql and give the command in mysql "flush table with read lock" so that all the connections are temporarly halts
FLUSH LOGS;
show slave status\G
show master status\G
2.) create the LVM snapshots
3.) mounting the LVM snapshots
4.) unmounting the lvm snapshots
5.)removing the snap shots
The detail steps are as follows:
###########step 1 and 2 ###############
/usr/bin/mysql -uroot -proot <<SQL_EOF
FLUSH TABLES WITH READ LOCK;
FLUSH LOGS;
show slave status\G
show master status\G
SYSTEM /usr/sbin/lvcreate --snapshot --size=5G --name=backup-test /dev/volumegroup/fs0/
UNLOCK TABLES;
SQL_EOF
##########step 3 #################
#first create the folder
mkdir /var/tmp/mysql-data1
#mouting the snap shot to temp folder we have created above
/bin/mount -o ro /dev/volumegroup/backup-test /var/tmp/mysql-data1
########step 4 unmounting the snap shots ##############
/bin/umount /var/tmp/mysql-data1
##### step 5 removing the snap shots ################
/usr/sbin/lvremove -f /dev/volumegroup/backup-test
############for more details the url is as follows
https://raw.github.com/nmilford/scripts/master/MySQL/makeMysqlSnapshot.sh
### to know more about LVM snapshot
http://www.howtoforge.com/linux_lvm
