[CentOS] What to backup?

Ross Walker rswwalker at gmail.com
Wed Feb 24 01:03:22 UTC 2010

On Feb 23, 2010, at 7:29 PM, Benjamin Franz <jfranz at freerun.com> wrote:

> Robert Heller wrote:
>> What *I'd* do, is have separate partitions for /, /var /opt and / 
>> home.
>> And do a monthy full dump of each file system, weekly incremental  
>> dumps
>> of /var and /opt, and daily or every other day incremental dumps of
>> /home.  It is probably iffy to get a meaningful dump of mysql's  
>> running
>> database.  It probably makes better sense to do a SQL dump -- 'man
>> mysqldump'
> If you can tolerate a few seconds of having your database offline, the
> fastest and easiest way to get a coherent snapshot is to keep
> /var/lib/mysql on its own LVM partition with extra unallocated extents
> and take an LVM snapshot with the database shutdown for just a few
> seconds. 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
> Now you have a static and coherent snapshot of the database that can  
> be
> used for restoration just by copying it into /var/lib/mysql and that  
> is
> safe to be backed up by ordinary backup software. And the total time
> offline for the backup is typically on the order ~10 seconds. If you  
> do
> it at 2AM no one is likely to even notice that you that you went  
> offline
> for 10 seconds or so.

Or a replica mysql database and use either mysqldump or lvm without  
having to take the master down or interrupt it's activities.


More information about the CentOS mailing list