6c4a91744a9f857f00ddd8802edb7465

Using hotbackup on Linux with LVM

2010-10-07 14:34

Write comment

Having a write-intensive database, backuping it with usual tools is no longer possible since backup action can take a while and data can be altered in the meanwhile ...

A solution to this is to use LVM snapshoting to do consistent backup.

Let's do an example, i'm about to hotbackup my /home :

 # grep home /etc/mtab
/dev/mylaptop/home-lv /home xfs rw,noatime 0 0 
In order to get a consistent image of the /home filesystem in the snapshot, we need to freeze it, so the log journal is flushed and no more accesses are done to it.
 # xfs_freeze -f /home
# lvcreate -L5G -s -n myhome_snapshot -s /dev/mylaptop/home-lv
# xfs_freeze -u /home
 
This will create snapshot named myhome_snapshot for Logical Volume mylaptop/home-lv. You should specify enough of undo space to hold modifications during backup process - I've specified 5GB in this case. If your undo size is not large enough snapshot will get invalidated.

You dont need more space (except those 5 gigs) on the box to create the snapshot, this is the magic part of all this ;)

So now, let's mount the snapshot and backup it :

Read more…

 Posts: 19/
19