TyrBackup

Table of Contents

1 Welcome to TyrBackup

TyrBackup is a backup tool developed by Michael Bernhard Arp Sørensen, Denmark. TyrBackup is a based on rsync and SSH. SSH is used for remote backup.

The documentation is a work in progress. I'll try to keep it updated as the development continues.

1.1 Dedication

TyrBackup is dedicated to Tyr, a faroe metal band. The band is named after the god Tyr from northern mythology. Tyr, the band, makes great music and lyrics that is food for thought.

Image of Tyr

Tyr, the band from the Faroe Islands.

TyrBackup is dedicated to my favorite music band, Tyr, from the Faroe Islands, and to Tyr from the Northern Mythology.

Image of Tyr and fenris, the wolf.

Tyr is the god of law and justice.

Tyr lost his hand while binding the Fenris wolf. The Fenris wolf would not let it be tied up, but Tyr offered his hand to the Fenris wolf saying that the Fenris wolf could bite the hand off if it was a trick. When the Fenris wolf understood that it was a trick, he bit the hand off Tyr. Tyr was the only god who was couragous enough and ultimately sacrified his hand to keep the other gods safe. Hail Tyr.

1.2 About the programmer

Lead programmer: Michael Bernhard Arp Sørensen, michael(at)arpsorensen.dk

Bernhard is currently working in the Royal Danish Air Force as a CIS specialist. In the sparetime Bernhard develops software, plays volleyball and listens to music from Tyr.

2 Download files

3 Specifications

For a good backup system I want the following specs:

  1. Easy restore
  2. Specified versions of backups
  3. Easy configuration
  4. Log of files/directories from each backup
  5. Log of backup size

4 Design

4.1 Rsync

TyrBackup creates backups by using rsync. Files are fetched from local mounts or through ssh.

4.1.1 Saving space with hardlinks

When backing up, we want to preserve space, bandwidth and time. Therefore we want to backup only the changed files and we want to keep a similar directory structure. We don't want a zipped archive that is difficult to restore from.

4.2 Modes of operation

There are 4 modes of operation:

  1. SimpleRotation
  2. HDMY
  3. HDWY
  4. Push

3 of the are for local storage. 1 is for remote storage.

4.2.1 SimpleRotation

This is the most simple type of backup. The default number of backups are defined in the backup job. When the maximum amount of backups are reached, older backups are reused. If the maximum number is increased in the job configuration, more backups are just made until the new maximum is reached. If the maximum number of backups is decreased, you need to delete the supernummary backups. If you accidentally delete to many, more backups will be created until the maximum number is reached.

4.2.2 HDMY

HDMY is for Hour, Date, Month and Year. Depending on your backup schedule, the largest amount of backups is : 24 hourly backups, 31 daily backups, 12 monthly backups and a backup for each year. The concept means that the backup contains the youngest possible version of the files. For example: the yearly backup is made on the 31st of december and the youngest daily backup is made at 23 hours.

4.2.3 HDWY

HDWY is very similar to HDMY, but differs in some places. There backups for each week in the year and for each day in the week.

4.2.4 Push

Push simply means that a local folder is syncronized to a folder on a remote server. This could be achieved by using rsync alone, but by using TyrBackup, you will have a single point of configuration.

4.3 Pseudo media rotation

For a given backup a certain amount of backup generations is specified, eg. 10 backups. The 11th time a backup is done, the oldest backup directory is renamed and overwritten with the new backup. If you increase the number of maximum allowed backups, the script just keeps adding new backup directory until the maximum is reached. If you decrease the number to eg. 5, the 5th oldest backup directory is used and you have to remove the backup directories manually.

5 Usage

5.1 Configuration

Configuration is done in 2 files: tyrbackup.conf and jobs.conf. All config files are in the /etc/tyrbackup folder.

5.1.1 tyrbackup.conf

This is the main configuration for tyrbackup. Here's the location of the backups and logs.

Example:

TYRTARGETBASEDIR=/backup TYRLOGDIR=/backup/logs

5.1.2 jobs.conf

All jobs are defined in jobs.conf. The file contains a job per line. Each property is separated be semi colon.

  • Description of each field:
    • hostname: Proper noun of the backup like host1, gw, TaskForceData. If remotehost over ssh, use FQDN or IP address.
    • hosttype: Unused for the moment.
    • backup type:
      • SimpleRotation: by a specific amount of backups
      • HDMY: by hour(24), date(31), month(12) and year
      • HDWY: by hour(24), day of week(7), week in year(52)
      • Push: push to remote server
    • protokol:
      • ssh
      • filesystem
    • excludefile: /relative/path/to/exclude/file
    • includefile: /relative/path/to/include/file
    • minimumsize: minimum amount of data before doing a backup
    • youngerthan: UNUSED for the moment. Only backup files younger than NUMBEROFDAYS
    • source path: path to backup source in local fs or over ssh
    • setsize: Number of backups in a set. Used in SimpleRotation mode.
    • remote path: path to backup destination on remote server over ssh
  • Examples:
    localhost;linux;SimpleRotation;filesystem;linux.excl;linux.incl;10000;all;/home/bernhard/development/backup-test/backupsource;30;NotUsed localhost;linux;SimpleRotation;ssh;linux.excl;linux.incl;10000;all;/home/bernhard/development/backup-test/backupsource;40;NotUsed localhost;linux;HDMY;ssh;linux.excl;linux.incl;10000;all;/home/bernhard/development/backup-test/backupsource;10;NotUsed localhost;linux;HDMY;filesystem;linux.excl;linux.incl;10000;all;/home/bernhard/development/backup-test/backupsource;10;NotUsed localhost;linux;HDWY;ssh;linux.excl;linux.incl;10000;all;/home/bernhard/development/backup-test/backupsource;10;NotUsed localhost;linux;HDWY;filesystem;linux.excl;linux.incl;10000;all;/home/bernhard/development/backup-test/backupsource;10;NotUsed localhost;linux;Push;filesystem;linux.excl;linux.incl;10000;all;/home/bernhard/development/backup-test/backupsource;10;/home/bernhard/development/backup-test/backuptarget

5.1.3 Include files

5.1.4 Exclude files

5.2 Running

Just run the file as root in a shell or from a crontab.

6 Future features

6.1 DONE Implement dry runs

CLOSED: 2013-03-15 fre 20:03

6.2 TODO Implement running only a few of the jobs instead of all jobs.


Date: 2013-03-15T22:38+0100

Author: Michael Bernhard Arp Sørensen

Org version 7.9.3e with Emacs version 24

Validate XHTML 1.0