7

I manage a CentOS 4.8 server for a small workgroup. Last year I converted the filesystem to LVM over software RAID (RAID 1, two mirrored drives).

I now have the following filesystems on LVM/RAID:

/dev/mapper/vg-home   619G  231G  358G  40% /home
/dev/mapper/vg-tmp    7.9G   55M  7.5G   1% /tmp
/dev/mapper/vg-usr    7.9G  2.7G  4.9G  36% /usr
/dev/mapper/vg-var    7.9G  3.1G  4.5G  42% /var

To back these filesystems up, I use rsnapshot and a couple of external 2TB USB drives that I rotate weekly. In practice that has worked very well. I have rsnapshot configured to do snapshots every four hours.

Given that configuration, should I also consider doing LVM snapshots? Are LVM snapshots more efficient? Could I be doing them more often than the rsnapshot backups every 4 hours without significantly impacting system performance?

I am aware that LVM snapshots could be used to ensure database consistency for backups, however this server doesn't run a database so that isn't really a concern.

It seems like there might be a way to do both LVM and rsnapshot backups in a complimentary fashion but I am unable to suss it out.

Phil Hollenback
  • 14,647
  • 4
  • 34
  • 51

2 Answers2

8

I'm a big fan of snapshots for backups, but I typically use them in the manner you'll find described for LVM snapshots -- Make a snapshot, mount it somewhere, back up the snapshot with your favorite backup tool (I like Bacula), then get rid of the LVM snapshot. Ideally this backup goes somewhere off-site

This dovetails very well with rsnapshot: Your rsnapshot snapshots can be instantly-available local backups, and they can also be captured in the off-site backup of the filesystem that you make from the LVM snapshot.

LVM snapshots are very similar to BSD UFS/FFS snapshots in that they store the deltas between when the snapshot was taken and the current system state: This means that performance will degrade as the snapshot and the main disk grow further out of sync, and there's some overhead for each snapshot you're maintaining (any change to the disk has to be tracked so the snapshot knows about it).
In practice this overhead isn't significant unless your disk changes frequently and you're keeping snapshots around for a long time.

See http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html for more on using LVM snapshots for backups (painted with the same broad strokes as what I just said).


Incidentally LVM (or UFS) snapshots are also a great "save game" kind of thing if you're about to do something REALLY DANGEROUS to a production server, but that's well outside the scope of your question

voretaq7
  • 79,345
  • 17
  • 128
  • 213
  • 1
    Hm I like this idea of doing lvm snapshots on the fly to 'save state' whenever you are about to make a big change. – Phil Hollenback Feb 03 '11 at 01:06
  • I've used FreeBSD UFS snapshots that way a few times -- it's not fantastic, but it beats the amount of time required to take a full backup of a system by miles :-) – voretaq7 Feb 03 '11 at 05:08
3

In my experience, doing snapshots with LVM have a huge impact on disk performance if you keep them for long time. I used to do my backup using LVM snapshot because I was backuping some sql servers as well. But I found that rsnapshot is very well suited to do that (I just had to write a small script to do the sql backup) and launch it with rsnapshot backup_script option.

Yann Sagon
  • 276
  • 3
  • 8