Using flexbackup

How to set up a NAS-based backup-to-disk system

Principles of operation

The server mounts a volume from the NAS, then starts flexbackup.
Once the flexbackup process terminates, the NAS volume is unmounted.
All backups are scheduled via cron. The NAS simply offers a samba (cifs, not smbfs!) share to store backups.
TODO: the share should be "world visible" as a read-only share, whereas it should me mounted read-write while doing the backup.

Installation

Install flexbackup:
aptitude install flexbackup

I prepared a wrapper script (to be called in a crontab) that mounts NAS volume, runs database dumps, runs flexbackup ant finally umounts NAS volumes (download link at page bottom). On my servers I install this script in /usr/local/sbin/do_backup.

...perhaps you also need these

Other than flexbackup, other packages/commands are needed. Check if your server(s) have the following commands installed:
mount.cifs
if not, aptitude install smbfs.

Configuration

Add NAS volume to the server filesystem

Most NAS offer their shared volumes as smbfs or (better) cifs shares.

Maybe, in some cases the use of NFS should be desirable, but NFS is poorly supported (AFAIK, works smoothly on Synology hardware, gives serious troubles on Buffalo Terastations), and, since we're dealing with backups, better stick to an affordable method...

I usually prepare a shared, read-writable folder on the NAS, called flexbackup (what a fantasy!).
On server side, I usually define /mnt/flexbackup as a mount point

On the server to be backed up, add a line to /etc/fstab:
//NAS/flexbackup /mnt/flexbackup cifs rw,user,noauto,options=rw,guest 0 2
Sanity check: try a mount /mnt/flexbackup...

Configure flexbackup

edit /etc/flexbackup.conf. Refer to man flexbackup.conf and to comments in the file itself.
At page bottom, you can download a sample flexbackup.conf
I prefer to make .tar.gz files, since IMHO this is the most commonly readable format (think about what to do in the case of a "bare metal" restore...)

Automate the process

Last, the backup process must be properly handled using cron, eliminating any possible user intervention. A reliable backup should not depend on human factors, shouldn't it?
The main issue here is backup level scheduling. I found a good source of information here and here (thanks to Sun!).

Sample crontab:

  1. <pre>
  2. 10 2 * * 1-5 /usr/local/sbin/do_backup daily
  3. 10 2 * * 6 /usr/local/sbin/do_backup weekly
  4. 4 5 1 * * /usr/local/sbin/do_backup monthly
  5. </pre>

For those who can't live without a GUI

Have a look at xelfbackup, a nice wrapper (with web-based reporting and control interface) to good oldflexbackup.

Note: this section is still "in progress". At present, I just installed the wrapper and am figuring out how to properly configure and run. Eventually this will replace my do_backup script, in the meantime I still use do_backup. Stay tuned!

Update [20090416] the do_backup script still does its job neatly: perhaps, it is a good wrapper script itself!

Download package from sourceforge.
Untar it.
Modify Makefile, in particular:

  1. <pre>
  2. BINPATH=/usr/local/bin
  3. MANPATH=/usr/local/share/man
  4. MOUNTPATH=/bin/mount
  5. </pre>

Compile it (make && make install)

AttachmentSize
flexbackup.conf - sample configuration file from one of my servers9.29 KB
do_backup.sh - flexbackup wrapper (bash) script to be called by cron6.8 KB