Myself> flush tables with read lock;
之后开始创建快照
[root@server0 mysql]# lvcreate -L 100M -s -n dbbackup /dev/mysql/mysql_data
Logical volume "dbbackup" created
快照作好就可以释放锁了
![](http://images2015.cnblogs.com/blog/993421/201607/993421-20160721112007857-2065415473.png)
现在我们可以开始拷贝备份数据了。
[root@server0 mysql]# mount /dev/mysql/dbbackup /mnt/
[root@server0 mysql]# mkdir /var/back
[root@server0 mysql]# cp -R /mnt/* /var/back/
[root@server0 mysql]# ls /var/back/
ibdata1 lost+found master-bin.000003 mysql
ib_logfile0 master-bin.000001 master-bin.000004 mysql.sock
ib_logfile1 master-bin.000002 master-bin.index test
备份完成后,卸载,并且删除快照。
[root@server0 mysql]# lvremove -f /dev/mysql/dbbackup
Logical volume "dbbackup" successfully removed