Online backup using Linux Logical Volume Manager (LVM)

Performing backup of your logical volume is pretty easy and fast. It is the safest way to backup any “open” files/databases.

1) Creating a snapshot of your current LVM

[root@svr2 ~]# lvcreate -L1000M -s -n volbackup /dev/VolGroup00/datavol
  Rounding up size to full physical extent 1.00 GB
  Logical volume "volbackup" created

2) You should see lvdisplay stating the snapshot LVM.

[root@svr2 ~]# lvdisplay /dev/VolGroup00/volbackup
  --- Logical volume ---
  LV Name                /dev/VolGroup00/volbackup
  VG Name                VolGroup00
  LV UUID                H1s7bn-TKCu-sdfE-Xi0M-oZNA-ixvq-xsWvZj
  LV Write Access        read/write
  LV snapshot status     active destination for /dev/VolGroup00/datavol
  LV Status              available
  # open                 0
  LV Size                100.00 GB
  Current LE             3200
  COW-table size         1.00 GB
  COW-table LE           32
  Allocated to snapshot  0.00%
  Snapshot chunk size    4.00 KB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

3) Create a folder for it to do a proper mount.

[root@svr2 ~]# mkdir /backupvol
[root@svr2 ~]# mount /dev/VolGroup00/volbackup /backupvol

4) Do the backup now.

[root@svr2 ~]# tar -cf /root/datavol.tar.gz /backupvol

5) Umount, remove folder and delete the snapshot LVM

umount /backupvol
rm -rfv /backupvol
lvremove /dev/VolGroup00/volbackup

Hope this helps someone out there…