Backups - Summarised

Discuss the Scalix Server software

Moderators: ScalixSupport, admin

skk54

Backups - Summarised

Postby skk54 » Sun Nov 05, 2006 7:41 am

Hi,
I have read (amd re-read) the backup posts in this forum and the how-tos on the wiki, plus had a look at the provided scripts. Here is what I think I know about backups (Scalix CE 10, SuSE 10 OSS)

There are three common reasons to reach for a backup:
1: Server dies (Bare metal restore)
2: Mailbox corruption (individual mailbox restore)
3: Deleted that supermega important email (single email restore)

In the case of 1:
Install the new servers operating system, copy across /var/opt/scalix and use the installer.

In the case of 2:
a) Restore the copy of that persons mailbox made with the omcpoutu to another mailnode, have them log-in and copy the folders/mail across to their account
b) Restore the copy of that persons mailbox to the main mailnode, wiping out their current account, but creating a new one (if you use the restore script on this Forum)

In the case of 3:
Do as 2: a) and let them retrieve the 'important' email themselves.

So, to the point of this post.

I have over 30 Gigabytes of email in the datastore currently (and growing). I cannot stop the scalix server for the 4 or 5 hours it takes the backup script on this forum to run, so I will not have a recent copy of /var/opt/scalix

So please tell me any methods by which I can accommodate 1: and 2: - that is, how can I get/make a list of accounts in a format that can be scripted into a new install for a baremetal restore as in 1: ? How do I integrate the information I have saved from the omcpoutu into the newly restored server -is it sufficient to run the restore script on the main mailnode?

By what combination/method can I backup a users email so that the email can be imported/saved outside the scalix datastore in mbox format for access by any 'ordinary' mail application?

I understand that the CE edition is 'unsupported' except by the generous people contributing to this forum (including the Scalix people) and I thank you all for your efforts. I hope that by asking these questions in one place new users will be able to find the information they need in a single place.
I am also aware that there is the new version 11 which will (probably) answer many of these questions, but I am sure there will be many people like me who will not roll out a new operating system with a new app on a production server, so I expect the version 10 CE to be around for a while yet.

Any input greatly appreciated.

skk54

Valerion
Scalix Star
Scalix Star
Posts: 2730
Joined: Thu Feb 26, 2004 7:40 am
Location: Johannesburg, South Africa
Contact:

Re: Backups - Summarised

Postby Valerion » Mon Nov 06, 2006 5:02 am

skk54 wrote:I have over 30 Gigabytes of email in the datastore currently (and growing). I cannot stop the scalix server for the 4 or 5 hours it takes the backup script on this forum to run, so I will not have a recent copy of /var/opt/scalix

So please tell me any methods by which I can accommodate 1: and 2: - that is, how can I get/make a list of accounts in a format that can be scripted into a new install for a baremetal restore as in 1: ? How do I integrate the information I have saved from the omcpoutu into the newly restored server -is it sufficient to run the restore script on the main mailnode?

Restoring /var/opt/scalix will also recover all the users. The best way to do this is to use LVM on your machine, omsuspend the server, do a snapshot of the mailstore, "omunsuspend" and backup the snapshot, then delete it afterwards. Of course this may involve completely rebuilding your machine, but backup downtime should be less than 5 minutes.

You can get a full userlist by using omshowu -m all, then get details about each by doing a omshowu -n "User Name" on each user.

Have a look at the following for inspiration (it is old and untested, and may not work properly any more). I will leave the import script as an excercise :)

Code: Select all

#!/usr/bin/perl

# Copyright: Conversant Systems (Pty) Ltd

$base_dir = "ScalixBackup";
$bin_dir = "/opt/scalix/bin";

mkdir $base_dir;

@all_mailnodes = `$bin_dir/omshowmn -D -f`;

foreach $mailnode (@all_mailnodes) {
        $mailnode =~ s/^\s+//g;
        $mailnode =~ s/\*\*//g;
        $mailnode =~ s/^\s+//g;
        $mailnode =~ s/\s+$//g;
        $mailnode =~ s/\s+/ /g;

        ($mailnode_name,$mailnode_domain) = split (/ /,$mailnode);
        ($ou1,$ou2,$ou3,$ou4) = split (/,/,$mailnode_name);
        $mailnode_fqn = "OU1=".$ou1;
        if ($ou2) {
                $mailnode_fqn = $mailnode_fqn."/OU2=".$ou2;
                if ($ou3) {
                        $mailnode_fqn = $mailnode_fqn."/OU3=".$ou3;
                        if ($ou4) {
                                $mailnode_fqn = $mailnode_fqn."/OU4=".$ou4;
                        }
                }
        }
        $mailnode_dir = $base_dir."/".$mailnode_name;
        mkdir $mailnode_dir;
        @all_users = `$bin_dir/omshowu -m $mailnode_name`;
                foreach $user (@all_users) {
                        $user =~ s/\/[\w\W]+//g;
                        $user =~ s/\s+$//g;
                        if ($user =~ / /) {
                                $has_firstname = "yes";
                                ($firstname,$surname) = split (/ /,$user);
                                $name_fqn="S=".$surname."/G=".$firstname;
                        }
                        else {
                                $has_firstname = "no";
                                $surname = $user;
                                $name_fqn="S=".$surname;
                        }
                        $user =~ s/[\s\_]/./g;
                        $name_file = $mailnode_dir."/".$user;
                        $name_fqn =~ s/_/ /g;
                        $fqn = $name_fqn."/".$mailnode_fqn;
                        $user_details = `$bin_dir/omshowu -n "$fqn" -S`;
                        open OUTFILE, ">".$name_file.",details";
                        print OUTFILE $user_details;
                        close OUTFILE;
                        $file = $name_file.",store";
                        `$bin_dir/omcpoutu -n "$fqn" -f "$file"`
                }
}


skk54 wrote:By what combination/method can I backup a users email so that the email can be imported/saved outside the scalix datastore in mbox format for access by any 'ordinary' mail application?

The only way I can think of to do this is via a tool like imapsync to a different set of UNIX mailboxes.

skk54

Backups - Summarised

Postby skk54 » Mon Nov 06, 2006 5:38 pm

Hi,
Thanks for the input. Rebuilding is not an option at this time, so the LVM/snapshot method is not available to me.

In place of that, I think the following would work:
1. In the case of a hardware failure:
a) Rebuild server
b) Re-install scalix
c) Import users via import script
d) Restore users mail from omcpoutu backup files to another mailnode
I am not sure c) is necessary - the restore script on this forum does warn that the user will be deleted prior to restoring, but I guess this would not restore the users extra email addresses or even perhaps their group memberships.

I also think that it may be possible to rsync the /var/opt/scalix directory, and exclude the /var/opt/scalix/data directory, as this is where the email 'lives' - and as I intend to do a omcpoutu each night, keeping 7 copies, an rsync once a week (excluding the data directory) should get the job done....

If I go down this route, I'll post how it works here. (and how long it takes, which is the real issue for me!)

Thanks,
SKK54


Return to “Scalix Server”



Who is online

Users browsing this forum: No registered users and 26 guests

cron