Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
We are using the backup2l utility for taking regular backups. To take a backup you simply need to run the following command:
cd [sources_dir]/scripts sudo make backup_dspace
The above make target will run the backup2l utility using the configuration file [sources_dir]/backup2l.dspace.conf.interpolated. The configuration file will be generated automatically using the local.properties keys. However, the following keys should be defined/updated in the local.properties file.
**ufal.backup.source = (a space separated list of files/dirs to be backed up; inside parenthesis)
we are currently taking backup of the following locations
- Installation directory
- Source directory
- Server configurations e.g. (/etc/tomcat6/ /etc/apache2/)
ufal.backup.target = target directory for backups
backup2l.max.level = 1
Possible values are 1..8
backup2l supports hierarchical differential backups with a user-specified number of levels and backups per level. With this scheme, the total number of archives that have to be stored only increases logarithmically with the number of differential backups since the last full backup. Hence, small incremental backups can be generated at short intervals while time- and space-consuming full backups are only sparsely needed.
backup2l.max.per.level = 6
Possible values are 1..8
This number will define the differential backups per level. After the max number of differential backups will reach a new level backup will be created and once the maximum level will be reached a new full backup will be created
backup2l.max.full = 4
Possible values are 1..8
This property will make sure that the given number of full backups will remain on the disk. Once the max will reach it will remove the oldest full backup.
backup2l.generations = 4
Number of backup generations to keep for each non-zero level. Old backups are automatically removed as long as at least GENERATIONS * MAX_PER_LEVEL backups for the respective level remain. For example, with MAX_LEVEL=3, MAX_PER_LEVEL=5, GENERATIONS=2 it is always possible to access the last 10 level-3 (e. g. daily) backups, the last 10 level-2 backups (e. g. 5, 10, 15, …, 50 days old), and so on.
For more information about these settings, please look at the details of hierarchal differential backups here http://manpages.ubuntu.com/manpages/hardy/man8/backup2l.8.html.
The setting we are using is as follows:
For each full backup we are storing one level and six differential backups. We will always keep the last 4 full backups with generations = 4, which means 4*6 differential backups. It means that we can restore a file back to any day in the past 30 days.
The above settings assumes that we are only running the backup scrips once per day. Also, the full backup may take few hours, it is a good idea to schedule the backups in such a way that the full backup will take place on weekends and on weekdays it will take differential backups
To make sure the backup is running daily, we are using the following cronjob, which is part of the /etc/cron.d/dspace file
00 02 * * * root cd /sources/dspace-1.8.2/scripts; sudo make backup_dspace
You can view the current cronjobs using the Control Panel “Cron Jobs” tab.
To fully restore the last successful backup, run the following commands:
cd [sources_dir]/scripts sudo make restore_backup RESTORE_DIRECTORY=directory_to_restore
This will restore all the files to the given restore directory. Once the restore is done, the files can be copied to the desired locations.
Checking available backups
sudo backup2l -c [sources_dir]/backup.configuration/backup2l.dspace.conf.interpolated -s
This will present a summary of all available backups. e.g.
Summary ======= Backup Date Time | Size | Skipped Files+D | New Obs. | Err. ------------------------------------------------------------------------------ all.1 2013-07-24 03:54 | 60.5G | 0 31328 |31327 0 | 0 all.11 2013-07-25 03:03 | 60.5G | 0 31336 |31335 0 | 3 all.12 2013-07-25 11:03 | 318.4M | 0 31788 | 1062 610 | 0 all.13 2013-07-25 11:05 | 2.0M | 0 31790 | 249 247 | 0 all.14 2013-07-25 11:05 | 708K | 0 31790 | 4 4 | 0 all.15 2013-07-25 11:07 | 1.0M | 0 31790 | 8 8 | 0 all.16 2013-07-25 11:07 | 708K | 0 31790 | 4 4 | 0 all.2 2013-07-25 11:07 | 60.5G | 0 31790 |31790 0 | 0
This summary can also be viewed in Control Panel’s backup tab.
Each backup archive is identified by its backup ID (BID). The number of digits determines the level. Level-0 (full) backups have a 1-digit BID, level-n backups have a BID of n+1 digits. The last digit is a serial number, the prefix identifies the lower-level backups on which a given backup is based on.
To view available versions of a specific file, run the following command.
sudo backup2l -c [sources_dir]/backup.configuration/backup2l.dspace.conf.interpolated -a '/sources/dspace-1.8.2/config/local.conf$' Listing available files... all.11 + 2348 07/24/13 22:17:42 6984.0000 0644 /sources/dspace-1.8.2/config/local.conf all.12 - 2348 07/24/13 22:17:42 6984.0000 0644 /sources/dspace-1.8.2/config/local.conf all.12 + 2366 07/25/13 07:30:45 6984.0000 0644 /sources/dspace-1.8.2/config/local.conf all.2 + 2366 07/25/13 07:30:45 6984.0000 0644 /sources/dspace-1.8.2/config/local.conf
In this list the + indicates that the file is new and thus contained in the archive file. A - indicates that the file has been removed (or replaced). Choose which backup you wish to recover from.
To recover a file from a specific date e.g. 07/24/13 22:17:42 we need the backup number all.11. To recover run the following command:
sudo backup2l -c [sources_dir]/backup.configuration/backup2l.dspace.conf.interpolated -t 11 -r '/sources/dspace-1.8.2/config/local.conf$'