lvm snapshot mysql data dir

#!/bin/bash
 
(
echo "FLUSH TABLES WITH READ LOCK;"
echo "\! lvcreate -L +10G -s -n snap_userdata /dev/vol01/userdata"
echo "UNLOCK TABLES;"
) | mysql -u root
 
if [ -e /dev/vol01/snap_userdata ]; then
        mount /dev/vol01/snap_userdata /mnt/snap_userdata/
fi
This entry was posted in admin, scripts. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *