VBackup - A modular backup utility
==================================

This is a collection of scripts that perform backup of systems.
It should support most of the unices out there (everything different should be
reported as a bug).

This version of vbackup can backup:

    * Postgresql databases
    * MySQL databases
    * Filesystems using GNU tar
    * XFS filesystems using xfsdump
    * dpkg and RPM databases
    * MBR, Partition tables, MD and LVM information
    * OpenLDAP database

The backup procedure is completely customizable and extendable by the user.

Requirements:
=============

 * GNU find
 * GNU tar - for the tar method
 * xfsdump - for the xfsdump method
 * RPM - for the rpm method
 * dpkg - for the dpkg method
 * openldap - for the openldap method
 * openssl - for the x509 method
 * mdadm and lvm - for the mbr method

Installation:
=============

# ./configure --sysconfdir=/etc
# make
# make install

This will install vbackup to /usr/local and assume the configuration files will
be placed under /etc/vbackup

Usage:
======

For usage run:
# vbackup --help

For a list of backup methods (scripts) run:
# vbackup --list

To get some information about a module run:
# vbackup --help <module>

example:
# vbackup --help xfsdump

Setup - the begginer's way:
===========================

There is a wizard script that will help you create basic configuration files.
Most probably you will want to use this one the first time. For more advanced
configuration and fine-tunning you will have to adjust the configuration files
yourself. Read the rest of this file to fully understand how you can use
vbackup.

To launch the wizard run:
# vbackup-wizard

and just answer its questions. The wizard also serves as an introduction.

Note that this will only create some trivial things. It is really suggest
to find your way around and use the next method

Setup - the CLI way:
====================

Let's assume you want to
    * Backup to an NFS mounted space
    * Perform backup of two partitions using xfsdump (full and incremental)
    * Perform backup of directories using tar (full and incremantal)
    * Perform mysql and pgsql backup

Run the following and answer the questions properly. You change your config
later by editing config files by hand.

1.  First create the config files:
    # vbackup --rc --add 00-remote.nfsmount
    # vbackup --rc --add 10-full.mysql
    # vbackup --rc --add 10-full.pgsql
    # vbackup --rc --add 20-level0.tar
    # vbackup --rc --add 20-level5.tar
    # vbackup --rc --add 30-level0.xfsdump
    # vbackup --rc --add 30-level5.xfsdump
    # vbackup --rc --add 99-remote.umount
2.  Create the two backup strategies:
    # vbackup --rc --init 0
    # vbackup --rc --init 5
3.  Populate them strategy 0:
    # vbackup --rc --enable 00-remote.nfsmount 0
    # vbackup --rc --enable 10-full.mysql 0
    # vbackup --rc --enable 10-full.pgsql 0
    # vbackup --rc --enable 20-level0.tar 0
    # vbackup --rc --enable 30-level0.xfsdump 0
    # vbackup --rc --enable 99-remote.umount 0
4.  Populate them strategy 5:
    # vbackup --rc --enable 00-remote.nfsmount 5
    # vbackup --rc --enable 10-full.mysql 5
    # vbackup --rc --enable 10-full.pgsql 5
    # vbackup --rc --enable 20-level5.tar 5
    # vbackup --rc --enable 30-level5.xfsdump 5
    # vbackup --rc --enable 99-remote.umount 5
5.  Check the configuration:
    # vbackup --check 0
    # vbackup --check 5
6.  Perform a level 0 backup
    # vbackup 0
7   Perform a level 5 backup
    # vbackup 5

Setup - by hand:
================
Let's assume the same scenario as above

1.  Go to /etc/vbackup and create a folder named rc.d. This will hold all the
    configuration scripts.
2.  Copy from the samples directory ($prefix/share/vbackup/samples) the
    following scripts to rc.d:
    * sample.nfsmount
    * sample.umount
    * sample.xfsdump
    * sample.mysql
    * sample.pgsql
    * sample.umount

3.  Rename sample.nfsmount to remote.nfsmount. (Any name with the extension
    .nfsmount will do) and edit it. Change the values of the variables to fit
    your needs.
4.  Rename sample.umount to remote.umount and edit it. Just set the mountpoint
    to umount.
5.  Rename sample.mysql to full.mysql and edit it. Read the note at the top of
    the script and set variables as needed.
6.  Rename sample.pgsql to full.pgsql and edit it.
7.  Copy sample.tar to level0.tar an edit it. Set the level to 0
8.  Rename sample.tar to level5.tar and edit it. Set the level to 5
9.  Copy sample.xfsdump to level0.xfsdump and edit it. Set the level to 0
10. Rename xfsdump to level5.xfsdump and edit it. Set the level to 5

11. Create two directories named backup.0 and backup.5 under /etc/vbackup
12. Enter backup.0 and create softlinks to the desired configuration files:
    # ln -s ../rc.d/remote.nfsmount 00-remote.nfsmount
    # ln -s ../rc.d/remote.umount 99-remote.umount
    # ln -s ../rc.d/full.mysql 10-full.mysql
    # ln -s ../rc.d/full.pgsql 10-full.pgsql
    # ln -s ../rc.d/level0.tar 20-level0.tar
    # ln -s ../rc.d/level0.xfsdump 30-level0.xfsdump
13. Enter backup.1 and create softlinks:
    # ln -s ../rc.d/remote.nfsmount 00-remote.nfsmount
    # ln -s ../rc.d/remote.umount 99-remote.umount
    # ln -s ../rc.d/level5.tar 20-level5.tar
    # ln -s ../rc.d/level5.xfsdump 30-level5.xfsdump
14. Copy to backup.0 and backup.1 the vbackup.conf.sample from the samples
    directory. Rename it to vbackup.conf and edit it as needed.
15. Check the configuration using:
    # vbackup --check 0
    # vbackup --check 5

To perform level 0 backup run
# vbackup 0

To perform level 5 backup run
# vbackup 5

How it works:
=============

When you run:
# vbackup 0

The script enters directory /etc/vbackup/backup.0 and searches for files named
XX-name.module, where <XX> is a number and <module> is a backup module/method.
All configurations are examined in an alphabetical order, so that the <XX>
prefix may be used to indicate the order. For each configuration file,
the coresponding module (<module>) is executed using the configuration file
options. A module may be used from zero to many times.

This way you'll have to create configuration files once and perform various
types of backups, depending on your needs.

The verbosity of the backup procedure may be controlled using the -d parameter.
Level 7 is recommended.

Backups that fail will not stop the backup procedure. There are however some
errors that will stop everything (ex: when failing to mount a filesystem)

Available modules:
==================

The following modules are available:

dpkg:	    Backup debian package lists
exec:	    Execute some shell commands
exist:	    Check whether a file/dir exists
ftar:	    Filesystem backup using tar and find
mbr:	    Backup MBRs, Partition Tables, MD and LVM information
mount:	    Mount a partition
mysql:	    Dump mysql databases
nfsmount:   Mount an NFS share
off:	    Don't do anything
openldap:   Backup OpenLDAP database
pgsql:	    Dump pgsql databases
rm:	    Remove a directory recursively
rpm:	    Backup RPM database
scp:	    Remote file copy using scp
tar:	    Perform filesystem backup using GNU tar
umount:	    Umount a partition
x509:	    Encrypt a file or a directory using x509 certificates
xfsdump:    Perform filesystem backup using xfsdump

More:
=====

More information about how vbackup actually works can be found in README.dev

Copyright:
==========

    Copyright (c) 2006-2012 Harhalakis Stefanos

License:
========

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

Contact:
========

    For bug reports, recommendations or anything else, you can find me at
    v13@v13.gr. I'll be glad to hear from you.

    The latest vbackup can be found at:
    http://www.it.teithe.gr/~v13/

Extending:
==========

    If you're interested in extending vbackup, just read the README.dev and
    have a look at the existing modules (I recommend mount and tar/xfsdump).
    A template for new modules is available with the name 'skel' under the
    scripts/ directory of the source code.

    If you believe you've created something that will be useful for others
    too, I'll be glad to include it in the distribution (preserving your
    copyright of course)

vim: set ts=8 sts=4 sw=4 noet formatoptions=rtcn textwidth=79:

