Table of Contents
The Symbiosis system includes a component designed to handle backups, using the flexible backup2l software.
backup2l was selected due to its simplicity and flexibility, which allows it to be used easily. By default the backup software executes once per day and archives the contents of significant directories to a local directory.
backup2l is controlled via configuration file /etc/backup2l.conf
, this
file is well documented, but in brief it contains three important pieces of
information:
/etc
, /srv
, etc).
/var/backups/localhost
)/
The Bytemark Symbiosis system will replace the static file
/etc/backup2.conf
with a symbolic link to a generated file, which is
produced by concatenating the contents of the /etc/symbiosis/backup.d
directory.
Additionally we’ve configured the backup software to easily execute a number of scripts before and after the backup is performed:
/etc/symbiosis/backup.d/pre-backup.d
/etc/symbiosis/backup.d/post-backup.d
To list the contents of your backup area you need to run backup2l with the "-l" flag:
~# backup2l -l all.1: /etc/.pwd.lock all.1: /etc/GeoIP.conf.default all.1: /etc/X11/Xresources/x11-common all.1: /etc/X11/Xsession all.1: /etc/X11/Xsession.d/20x11-common_process-args all.1: /etc/X11/Xsession.d/30x11-common_xresources all.1: /etc/X11/Xsession.d/40x11-common_xsessionrc all.1: /etc/X11/Xsession.d/50x11-common_determine-startup ...
Here you will see the contents of the /etc
directory which have
been archived.
If you’d like to restrict this view you can apply a regular expression to filter the results. For example we can list the files which match the pattern passwd with this command:
~# backup2l -l passwd Listing locations... all.1: /etc/exim4/passwd.client all.1: /etc/passwd all.1: /etc/passwd- all.1: /etc/phpmyadmin/htpasswd.setup all.1: /etc/pure-ftpd/pureftpd.passwd ...
To illustrate how this works, an example is used. We’re looking for a
backup of the file /etc/passwd
.
First log in to your machine over SSH (see Chapter 10, Connecting to your server via SSH) as admin.
To find the available versions of the file, run sudo backup2l -l '/etc/passwd$'.
The dollar sign is there to show that you want an exact match of
/etc/passwd
. The first time you run sudo you will be prompted
for the admin password. The following output will be generated
by backup2l.
backup2l v1.4 by Gundolf Kiefer Active files in <all.1101>: 1 found in all.1101: 0 ( 1 left) found in all.11: 1 ( 0 left) Listing locations... all.11: /etc/passwd
This shows the latest available version of the file
To recover it you should run sudo backup2l -r '/etc/passwd$'. The following output will be generated
backup2l v1.4 by Gundolf Kiefer Active files in <all.1101>: 1 found in all.1101: 0 ( 1 left) found in all.11: 1 ( 0 left) Restoring files... all.11.tar.gz: 1 file(s) using 'DRIVER_TAR_GZ'
That has restored the file to etc/passwd
in the current directory.
It is not recommended to run this program in the /
directory, as any existing files will get overwritten.
It is also possible to pick which version of a file you wish to restore.
First login to your machine over SSH as admin
Then, to show all available versions of a file, run sudo backup2l -a '/etc/passwd$'. Again, the first time you run sudo you will be prompted for a password. The following output is generated.
backup2l v1.4 by Gundolf Kiefer Listing available files... all.101 - 1067 06/18/08 13:59:47 0000.0000 0644 /etc/passwd all.101 + 1118 06/19/08 11:29:10 0000.0000 0644 /etc/passwd all.108 - 1118 06/19/08 11:29:10 0000.0000 0644 /etc/passwd all.108 + 1153 08/27/08 10:25:45 0000.0000 0644 /etc/passwd all.11 - 1067 06/18/08 13:59:47 0000.0000 0644 /etc/passwd all.11 + 1153 08/27/08 10:25:45 0000.0000 0644 /etc/passwd all.1 + 1067 06/18/08 13:59:47 0000.0000 0644 /etc/passwd
Note that the versions are not shown in date order, and that the dates are in
the US mm/dd/yy
format. In that 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 the file dated 19th June 2008, you need backup
number 101 — remember the +
indicates that it is present in that
archive. To recover that file, run sudo backup2l -t 101 -r '/etc/passwd$'
backup2l v1.4 by Gundolf Kiefer Active files in <all.101>: 1 found in all.101: 1 ( 0 left) Restoring files... all.101.tar.gz: 1 file(s) using 'DRIVER_TAR_GZ'
Notice the -t 101 argument which specifies which backup we want to restore from.
We have now successfully restored the file to etc/passwd
in the
current directory. We can check by running ls -la etc/
total 16 drwxr-xr-x 2 root root 4096 2008-09-09 09:56 . drwxr-xr-x 14 root root 4096 2008-09-09 09:51 .. -rw-r--r-- 1 root root 1118 2008-06-19 11:29 passwd
The Symbiosis system assumes that it is running upon a host provided by Bytemark, with access to an associated external storage area.
As documented every executable located in the directory
/etc/symbiosis/backup.d/post-backup.d
is executed at the conclusion of a successful backup.
By default only a single script is included, which attempts to determine the
name of the remote backup space associated with your machine and copy the
local backup directory of /var/backups
to this remote location.