Network Attached Storage

 

For performance reasons, it is recommended to keep indexes local to the machine running MailArchiva. The store data, however, may be stored on an network attached storage device (NAS) or storage area network (SAN).

 

High Volume/Performance Note: In some environments, the V2 archive format (enabled by default) is slow to archive on NFS and SMB shares.  This is likely due to the complex locking mechanisms of the V2 archive format. If faster archiving performance is required, switch the volume format to V3 in Configuration->Archive and thereafter create a new volume. The server will write data in a more simplified manner, and archiving performance should increase substantially.

 

NFS vs ISCSI: In environments where high throughput archiving is needed, the use of sharing protocols (e.g. NFS/SMBFS) for mounting external file systems is not an appropriate choice. Our tests show that archiving performance is at least 50 - 100 percent faster on drives mounted using ISCSI/ethernet vs file systems mounted using NFS/ethernet.


Windows

 

On Windows, when referring to a remote path, it is possible to specify the network path as a standard UNC path (e.g. "\\server\share\file_path").

The MailArchiva Windows Service may not have sufficient access to mapped drives. It may be necessary to change the user account the MailArchiva service is running under. To accomplish this, from the Services Control Panel applet (not the MailArchiva task tray icon configuration!), select the service, right click, select Properties, select Logon Tab, enter network Administrator account login account details, save and restart the MailArchiva server.
 

In the Volumes tab of the MailArchiva configuration, click add new volume. Enter the UNC network path as the store directory (e.g. server\store\store0). Make sure the index path you enter is on a local drive (e.g. c:\index).
 

Linux

 

To use an external storage device, it is best to define a mount point to the root of the NAS device (e.g. \mnt\mailarchiva) using the Linux mount, smbmount or nfsmount commands. When adding multiple volumes in the MailArchiva configuration screen, in the store directory field, specify a sub directory of the mount point (e.g. \mnt\mailarchiva\store1).

MailArchiva will automatically create the directory store1 (you do not need to do this yourself!). Using this configuration, one does not need to create multiple mount points for each volume. Be sure to add the mount point to fstab so that upon machine reboot, MailArchiva will continue to have access to the device.
 

If MailArchiva is being configured to write to an external NAS, whether the volume store or the backup store, it is important to ensure that the directory where the mount point is created is immutable (i.e. not writeable even by ROOT). This ensures that MailArchiva will not write data to the local drive when the mount is disconnected. This is especially important in situations where mount points are unstable.

 

  1. Create the local mount directory
    a) mkdir mnt/store1
  2. Execute "chattr +i /mnt/store1" (this sets the immutable flag so that even the ROOT account cannot write)
  3. Mount the external NAS to /mnt/store1 by adding the following to /etc/fstab
    a. smbfs
    //192.14.12.122/archive mnt/archive smbfs username=admin,password=pw
    b. nfs
    192.14.12.122:/archive mnt/archive nfs
    c. check by typing mount
Setting Default Permissions
 

Edit the startserver script with /opt/mailarchiva/server/startserver. Add line umask 022 in the beginning to ensure that rw permission to ROOT only.

 

Remote SMB/NFS Share Locking

 

You can use mounted shares, but some poorly implemented NAS's may not be able to cope with the locking and synchronization of the V2 format. To resolve this, please disable strict locking in the SMB or NFS drivers or switch to V3 format.

 

For example, for SMB shares, disable strict locking in smb.conf as follows:

 

[global]
strict locking = no

 

If this remedy does not help, it is possible to switch MailArchiva to use more rudimentary file format. In Configuration->Archive, set volume format to V3.


Auto Mount Script
 

To ensure that remote mount points are remounted, insert this script in a cron job:

 
----------------------------------------------------------------------
created check_mount script    [ /usr/local/sbin/check_mounts.sh ]
----------------------------------------------------------------------
#!/bin/sh
# --------------------------------------------------------------------
# purpose: check mounted partitions,
#  log if not mounted + mount and notify admins
# args:  none
# deps:  bash, GNU utils, logger, /proc, /etc/fstab
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# configuration
# --------------------------------------------------------------------
FSTAB_EXCL="(^#|noauto|none|user)"
PROGNAME=$(basename $0)
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# configure destination address for emails (admins)
# --------------------------------------------------------------------
if [ -f /etc/default/suk_scripts ]; then
. /etc/default/suk_scripts;
else
ROOTMAIL="root@`hostname --fqdn`"
fi
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# functions
# --------------------------------------------------------------------
function err_descr() {
case "$?" in
  0) err_rv="OK"
   ;;
  1) err_rv="FAILED"
   ;;
  *) err_rv="$?"
   ;;
esac;
}
function log() {
/usr/bin/logger -i -p kern.warn -t ${PROGNAME} "$@";
}
function log_mail() {
mail -s "$@" ${ROOTMAIL} ; log "$@";
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# check mounts
# --------------------------------------------------------------------
if [ ! -f /proc/mounts ]; then
log "WARN: /proc wasn't mounted!"
mount -t proc proc /proc; err_descr
err_descr
log_mail "WARN: mounted /proc (${err_rv})"
fi
egrep /etc/fstab -ve "${FSTAB_EXCL}" | while read i; do i=( ${i} )
# empty ?
case ${#i[0]} in
  0) log_mail "FATAL: I shouldn't have read ${i[@]} !"
     eval ${i[0]:=ERROR} 2>/dev/null
     ;;
esac
# select device
case ${i[0]} in
  /dev*)
   dev=( ${i[0]} ${i[1]} )
   ;;
  *)
   dev=( UNKNOWN UNKNOWN )
   ;;
esac
# munge rootfs
case "${#dev[1]}" in
  1) case "${dev[1]}" in
   /) dev[0]=/dev/root
   ;;
     esac
     ;;
esac
# check mounts
grep /proc/mounts -e ${dev[0]} &> /dev/null
case "$?" in
  1) case ${dev[0]} in
   /dev/root)
    /bin/true
    ;;
   UNKNOWN)
    ;;
   *)
    log "WARN: ${dev[1]} isn't mounted"
    mount ${dev[1]}; err_descr
    log_mail "INFO: mounted ${dev[1]}"
    ;;
     esac
     ;;
esac
done
# --------------------------------------------------------------------
exit $?
----------------------------------------------------------------------
----------------------------------------------------------------------
added check_mounts to cron    [ /etc/cron.d/check_mounts ]
----------------------------------------------------------------------
*/15 * * * * root /usr/local/sbin/check_mounts.sh
----------------------------------------------------------------------
© 2005 - 2024 ProProfs

Found this information useful? Visit mailarchiva.com to learn more about MailArchiva.

-