Drop me a message !
english french

SME and backups

Type How To
Version 1.1
Tested on SME 6.0 and 6.0.1

Subject
Backup to desktop : custom mode
Others Ways
Change Log

Subject

SME is a great product, but we need to think sometimes to do backups...

There is a backup tool in the server-manager. This tool permit two kinds of backup :

Backup to desktop : custom mode

Some informations about the 'backup to desktop' function (via the WEB Browser).

I must here say that I'm currently trying to rewrite a How-to I had found on Internet. I f someone knows the original how-to, I thanks you to give me the information.

First, it seems that the 'Backup to Desktop' functions encounters greats troubles if the backup to do are big.
It seems that the backup cannot be greater than 4 GBytes.
Worse, it seems that the restore functions hangs if the backup file is greater than 2 GBytes !

This solution is well suited for smalls backups. But Hard Drives are greater and greater, and our Nature is to fill the gaps...If you only solution to backup is the backup to desktop, it could be great to have the possibility to 'tune' the backup.

But, to begin, what is exactly backup by this function ? This is somewhat 'SME Version' dependant, but since SME 5.5 the list is fairly the same. Simply, it is not stored at the same place.
In SME 6.0 (and I think SME 5.6 also) the list of files an directory to backup is set in a file named :
/usr/lib/perl5/site_perl/esmith/Backup.pm
Here is the script part who set the backup list (this function begins at line 70) :

sub restore_list
{
    my ($self) = @_;

    return (
        'home/e-smith',
        'etc/e-smith/templates-custom',
        'etc/e-smith/templates-user-custom',
        'etc/ssh',
        'root',
        'etc/passwd',
        'etc/shadow',
        'etc/group',
        'etc/gshadow',
        'etc/samba/smbpasswd',
        'etc/smbpasswd',
    );
}
Don't be fooled by the name, this is really the list used in backup session also.

With SME 5.5, the list was directly included in the backup script :
/etc/e-smith/web/functions/backup
(The list start near line 58)

It's possible to add files in this list, with the following constraints :

But, adding entries will only increase the size of the backup, and we just want to decreases it !

It's possible to create a file containing a list of excluded files and directories.
For example, let's imagine that you have an I-Bay named backup witch contains your network's P.C. backups. It's not a great idea to backup the backups !
You could also have an ibay named everybody and in this ibay, a folder named documentation. In this directory, you copy lots of documentation for the convenience of your users. It's maybe not a good idea to backup theses documentations, generally coming on CD-Roms.

Notice : this exclude file works in subtracting files and/or directories from the first list we have seen. there's no need to put the directory files/big/ in this file if files/ is not in the inclusion list seen before !

exclude file creation

It seems to be a good idea to put this file in a backuped area... As this file is a configuration file, it can be stored in /home/e-smith. I choose to name it /home/e-smith/backup.exclude
The file must contains the list of files and directories to exclude, with the full path, but without the leading /, as for the include list.
In our sample, here is the result :

home/e-smith/files/ibays/backup
home/e-smith/files/ibays/everybody/documentation

Now, we have to change the backup script to instruct it to use our 'backup.exclude' file. Here we have two choices :

  1. You are in a bad mood with vi, and you would like to use a already modified backup file. Go HERE.
  2. You really like to do everything by yourself, and, remember, you're the best. Go HERE.

install of a pre modified backup file

You'll find a modified /etc/e-smith/web/functions/backup file HERE.
This file not only includes the change to accept the exclude file, but :

Warning : don't use this file if your system is not running SME 6.0 or 6.0.1. I really don't know if this file can work on others versions !

Here is a direct installation instruction. I have removed all return messages, this is more useful for cut & paste work !

cd /tmp
cp /etc/e-smith/web/functions/backup .
wget http://www.schirrms.net/files/backup.tar.gz
tar -xvPzf backup.tar.gz
chown root:admin /etc/e-smith/web/functions/backup
chmod 4750 /etc/e-smith/web/functions/backup

The most curious can then use this command :

diff -u backup /etc/e-smith/web/functions/backup
to see the change done on this file.

That's all, you have now a 'custom backup'.

'Hand made' backup file customization

With your favorite text editor, change the file /etc/e-smith/web/functions/backup
You'll find (at line 447 for SME 6.0, at line 384 for SME 5.5) this line :

            "/bin/tar --directory / --create @directories --file=-"
You must add this part --exclude-from /home/e-smith/backup.exclude The result is :
            "/bin/tar --directory / --create @directories --exclude-from /home/e-smith/backup.exclude --file=-"

After editing this file, it's better to verify the access rights :

# ls -l /etc/e-smith/web/functions/backup
-rwsr-x---    1 root     admin       32833 mar 12 22:06 /etc/e-smith/web/functions/backup
If the first part is not exactly -rwsr-x--- you have to use this command :
chmod 4750 /etc/e-smith/web/functions/backup
If the owner and group are not root and admin you have to use this command :
chown root:admin /etc/e-smith/web/functions/backup

That's all, you have now a 'custom backup'.

Others Ways

How, that's great, but if you need to backup more than 2 GBytes of data ?

you'll find on this site myezserver.com a contrib. : backup2ws witch permits backup to desktop greater than 2 GBytes, by splitting the backup in a few files of predetermined size (for instance 2 GBytes). I didn't test this contrib., it's up to you !

Change Log

12 mars 2004 Initial version
19 mars 2004 Better explanation of the file backup.exclude.
Link to my customized /etc/e-smith/web/functions/backup file.