SEARCH
TOOLBOX
LANGUAGES
LVM

LVM

From GarrettHoneycutt

Jump to: navigation, search

snapshots

This example will do a snapshot of a mysql partion.

start with checking how much disk space is used

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg1-mysql
                      493G   14G  454G   3% /data/mysql

Since it is 14G we will make our partition slightly larger, at 16G

# lvcreate -L16G -s -n dbbackup /dev/vg1/mysql
# mkdir /data/dbbackup
# mount -o ro /dev/vg1/dbbackup /data/dbbackup/
# cd /data && tar -vcf dbbackup-`date -I`.tar dbbackup/ /etc/my.cnf
# umount /data/dbbackup
# lvremove -vf /dev/vg1/dbbackup
# rm -fr /data/dbbackup
# bzip2 -v9 dbbackup-`date -I`.tar 
# mv dbbackup-`date -I`.tar.bz2 backups/