12.2. Backup

There is a backup module included in Webmin. You find it under the tab "Servers" and "Skolelinux Backup", or https://tjener.intern:10000/slbackup

Figure 12-1. Webmin Servers

This is the place in Webmin where you find slbackup.

Figure 12-2. Slbackup, General

Slbackup has 5 modes of operation;

Figure 12-3. Slbackup, Backup Details

This is where you set the time that you want the backup to be done, which will then take place at that time every day.

Figure 12-4. Slbackup, Backup Details, Backup Clients

Here you configure which machine you want to backup. You specify the IP address, together with the directories that you want to backup, and how long you want to keep a copy of the backup.

Figure 12-5. Slbackup, Backup Details, Backup Server

Here you set up the details for the machine that is going to do the backup. The most important detail is where the backup is going to be stored. The default backup partition is the LVM partition /skole/backup, see section Section 8.5.3. But there is nothing to stop you from setting in an extra hard drive and storing your backup there instead.

If you are observant, you may have noticed that we place the backup on the same hard drive as the one we take backup of. Stupid? Not so, if we take backups as an extra service for our users in case they accidentally delete a file. It is, of course, stupid to store your backup on the same hard drive if the purpose is to guard against a drive getting broken. Then it is wiser to set up a machine with a workstation profile, see Section 2.5, and install some really large capacity hard drives and use slbackup to make the backup external- making that machine your backup server.

Figure 12-6. Slbackup, Restore

What good is it to have a backup utility, if you can't put the files back that have been deleted? By choosing "Restore" you have the possibility to choose which machine you want to get the files from, as well as which file or entire directory you want to get. You can also use everything that you have taken a backup of on the machine in question.

Figure 12-7. Slbackup, Restored Files

When you have chosen which machine you want to get the backup from, then you will get to make several more choices, among which the date/time you want to restore the backu and where you want the files to be placed. To start with, it's wise to use the directory /tmp/<macinename>.

It's smart to place the files being restored in the directory /tmp/<machinename>. Everything that is stored in this directory gets deleted when the machine reboots. In addition, by placing the files there, in this temporary directory, you make sure that you don't accidentally write over the wrong files (when you replace an old file with a new one that has the same name). After you have taken out the files that you need to restore, then you must go into this directory, /tmp/<machinename>, and use a file manager, see Section 13.4, to get out the files that you want.

Figure 12-8. Slbackup, Maintenance

By choosing "maintenance" you get the possibility to delete old backups that you no longer have any use for, or place for.

Figure 12-9. Slbackup, SSH Keys

In order to be able to take a backup over the network from other machines, without being asked each time for a password, SSH has been set up in such a way so that you only type in the password once.

12.2.1. Comparison of Various Versions of the Same File

If you have "destroyed" the format of a file, for example /etc/dhcp3/dhcpd-skolelinux, but you know that you have a backup of that file which is good, then you can use on of several programs to compare the various versions of that file. If you have chosen to restore, then the old version of the file /etc/dhcp3/dhcpd-skolelinux will be placed in the directory /tmp/<machinename>/etc/dhcp3/dhcpd-skolelinux. A command-line based program is included to do a comparison of the files. The program is called diff, and is used in this fashion

diff /tmp/<machinename>/etc/dhcp3/dhcpd-skolelinux /etc/dhcp3/dhcpd-skolelinux

In this example, I have two examples of the file dhcpd-skolelinux, There is an error in one of them- it lacks two }-parentheses. This is the result of running the command diff with these two files:


klaus@tjener:~$ diff /etc/dhcp3/dhcpd-skolelinux.conf /tmp/tjener/etc/dhcp3/dhcpd-skolelinux.conf
217c217
<     }
---
>
225c225
<     }
---
>
Fortunately there are other programs that do the same job. One of them mgdiff can be installed with

apt-get install mgdiff

see
Section 8.9 for how to add new packages. mgdiff has a graphical interface (GUI). If I start mgdiff and open the two files in this program, this is what I see:

12.2.2. Dedicated Backup Server

Warning

Slbackup is not really meant to be used in this fashion. So do this at your own risk!

By setting up a machine with a "workstation",profile Section 2.5, and installing Webmin and slbackup, you can quickly set up a very user-friendly and powerful backup machine.

apt-get install slbackup webmin-slbackup

When combined with making a backup volume, see Section 8.5.8, this is a fine way to do backups of files all the time.

By adding more backup clients, see Figure 12-3, by filling in the IP address of the machine you want to backup, for example, the IP address for the "main server" is 10.0.2.2

Be aware that taking a backup over a network can take a long time, so it is best done outside of office hours/school time.

12.2.3. Slbackup from the Command Line

There are commnds that can be run from the command line, so you don't need to start a net browser and Webmin.


List of times backup is available from (lokal og external):
 rdiff-backup --list-increments /skole/backup/tjener
 rdiff-backup --list-increments backup.intern::/skole/backup/tjener

List of files in a given backup ('--list-at-time now' gives the last one):
 rdiff-backup --list-at-time 2004-02-22T01:30:02-04:00 /skole/backup/tjener/etc/ltsp/

Restore files from a given time ('--restore-as-of now' gives the last one):
 rdiff-backup --restore-as-of 2004-02-22T01:30:02-04:00 /skole/backup/tjener/etc/dhcpd.conf /tmp/dhcpd.conf

12.2.4. Slbackup Log Files

You find the log files for slbackup in /var/log/slbackup/slbackup.log. This is where information is logged about when the last backup was done, how much was changed, etc

--------------[ Session statistics ]--------------
StartTime 1086202803.00 (Wed Jun  2 21:00:03 2004)
EndTime 1086204514.88 (Wed Jun  2 21:28:34 2004)
ElapsedTime 1711.88 (28 minutes 31.88 seconds)
SourceFiles 56607
SourceFileSize 1625082476 (1.51 GB)
MirrorFiles 41244
MirrorFileSize 1060012665 (1011 MB)
NewFiles 15372
NewFileSize 564463215 (538 MB)
DeletedFiles 9
DeletedFileSize 65488 (64.0 KB)
ChangedFiles 344
ChangedSourceSize 667575185 (637 MB)
ChangedMirrorSize 666903101 (636 MB)
IncrementFiles 15725
IncrementFileSize 1936873 (1.85 MB)
TotalDestinationSizeChange 567006684 (541 MB)
Errors 0
--------------------------------------------------

Jun 02 21:28:36 - Successfully finished backing up client tjener
Jun 02 21:28:36 - Finished slbackup.
It pays once in a while to have a look at this file, check that you have "Successfully finished backing up"