[CentOS] What to backup?

Benjamin Franz jfranz at freerun.com
Wed Feb 24 01:04:21 UTC 2010


Benjamin Franz wrote:
> Something like the following:
>
> /bin/mkdir /mnt/mysql-snapshot
> /sbin/service mysql stop
> /usr/sbin/lvcreate --permission r -L16G -s -n dbbackup /dev/mysql/data
> /sbin/service mysql start
> /bin/mount -r /dev/mysql/data /mnt/mysql-snapshot
> /usr/bin/rsync -Saq --delete /mnt/mysql-snapshot /var/lib/mysql-backup/
> /bin/umount /mnt/mysql-snapshot
> /usr/sbin/lvremove -f /dev/mysql/data
>   
Whups. I made a serious error with the LVM volumes above. You would end 
up removing your database partition. Not good.

It should read like this:

/bin/mkdir /mnt/mysql-snapshot
/sbin/service mysql stop
/usr/sbin/lvcreate --permission r -L16G -s -n dbbackup /dev/mysql/data
/sbin/service mysql start
/bin/mount -r /dev/mysql/dbbackup /mnt/mysql-snapshot
/usr/bin/rsync -Saq --delete /mnt/mysql-snapshot/ /var/lib/mysql-backup/
/bin/umount /mnt/mysql-snapshot
/usr/sbin/lvremove -f /dev/mysql/dbbackup

-- 
Benjamin Franz



More information about the CentOS mailing list