Technical article 126531

OMS4.2/4.1:How to restore a single users mail box from the cpio backup files.

OpenServer 5.0.7UnixWare 7.1.4

Written · Last revised

Problem

By default, SCO office 4 automatically backup all users mail boxes into a gzipped cpio file.

The files are located in:
/opt/insight/htdocs/is4web/tar.

When using the restore feature from within the web admin tool, it will restore all users mail.

If you only want to restore a single users mail box, follow the directions below.

This is documented below as "RESTORE FROM GZIPPED CPIO FILE".

However, this can consume large disk space quantities depending on the amount of mail stored.

It might be, therefore, useful to turn this feature off in the ADMIN GUI -> Tools -> Task Scheduler -> Backup User Mailboxes -> Disable

The alternative would be to backup to tape and this is detailed in "RESTORE FROM A CPIO ARCHIVE".

Solution

- RESTORE FROM GZIPPED CPIO FILE
  ------------------------------
Please follow the directions below:
1.  Log on a root user.
2.  Change to the /opt/insight/bin directory.
3.  Create the script listed below and name it mrestore.
4.  Change permissions on mrestore to -rwxr-xr-x
# chmod 755 mrestore
5.  If you want to restore the mail box for user tomm,
type the following and follow the directions
# /opt/insight/bin/mrestore
6.  You are now finished.
******** Below is the start of the script file ********
******** named mrestore                        ********
#/bin/sh
# This script, named mrestore, is intended to be
# used to restore a users mail box from a system
# running SCOoffice 4 on OpenServer 5.0.7.
	CPIO=/bin/cpio
	GZCAT=/bin/gzcat
	ARCDIR=/opt/insight/htdocs/is4web/tar
clear
echo "What is the user name that you wish to restore mail
box for? "
read muser
mchar=`echo $muser|cut -b 1`
ls $ARCDIR
echo ""
echo "Type in the file name to be used to extract the
$muser mail box from: "
read mfile
echo ""
echo "Extracting mail box for user $muser"
echo ""
sleep 2
$GZCAT $ARCDIR/$mfile | cpio -icdmv
"/opt/insight/var/spool/imap/$mchar/user/$muser/*"
echo ""
echo "Restore from archive has just completed. "
echo "Will now reconstruct $muser mail box"
echo ""
sleep 2
su cyrus -c "/opt/insight/bin/reconstruct -rf user/$muser"
echo ""
echo "The recontruct for user $muser is complete"
- RESTORE FROM A CPIO ARCHIVE
  ---------------------------
You data has been backed up to tape with:
# cd /
# find . -print | cpio -ovc -C32768 -O/dev/rmt/ctape1

this will backup the mail in the format:

opt/insight/var/spool/imap ...

and individual mailboxes would be restored with:

# cpio -ivdumc -C32768 -I/dev/rmt/ctape1 "opt/insight/var/spool/imap/m/user/myuser*"

under the current location of where you ran "cpio" from.

Assuming that the user's mailbox data is now in:

/opt/insight/var/spool/imap/m/user/myuser

then prior to reconstructing the user's mailbox with:

/local/sysadm/reconstruct_mail.sh
        -----
        echo "Running Reconstructing for $1 ... "
        su cyrus -c "/opt/insight/bin/reconstruct -rf user/'$1'"
        echo "Checking Quota ... "
        su cyrus -c "/opt/insight/bin/quota -f user/$1"
        echo "Setting Permissions ... "
        A=`echo $1 | cut -c1` export A
        if [ ! -d /opt/insight/var/spool/imap/$A/user/$1 ]; then
              echo "User $1 does not exist!!"
	        exit 1
        fi
        chown -R cyrus:cyrus /opt/insight/var/spool/imap/$A/user/$1
        echo "Done!"
        -----

Consider whether the Cyrus MailStore knows about the ACL's and folders for this particular user.

In which case it may be useful to each night take a cyrus dump of the Cyrus Mailstore database with:

# su cyrus -c "/opt/insight/bin/ctl_mboxlist -d" > cyrus.out
to restore this completely then:
# su cyrus -c "/opt/insight/bin/ctl_mboxlist -u" < cyrus.out
NOTE:     Quota is set in the Admin GUI for each user under View Mailboxes.

This is stored and can be replicated to other servers in:

/opt/insight/var/imap/quota

From the Xinuos technical article database, record 126531. Reproduced with permission. The original is at www.sco.com/ta/126531, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.