This page is out of date, please use our new website https://surgemail.com

NetWin Database Mode

Enable using: g_maildir_netwin "true".

Warning! This feature is in Beta test stage, we have run it ourselves for several months and have had no problems. We haven't heard from any customers about any problems either. We would definitely recommend keeping a backup(as you should anyway) if you decide to go with this method or running a mirror that is using the old/standard maildir method.

How it works:

Instead of storing each mail message as an individual file messages are stored in 'bucket' files which contain many messages, an index file contains a list of the contents of all of the bucket files.

So a folder with 100 mail messages in it might look like this:

28/09/2005 05:15 p.m. 1,120 bkt.idx
28/09/2005 05:15 p.m. 0 bkt.lock
28/09/2005 05:15 p.m. 7,578 bkt_0.bkt
28/09/2005 05:15 p.m. 4,450 bkt_0.head
26/09/2005 05:09 p.m. 442,871 bkt_1127711348.bkt
26/09/2005 05:08 p.m. 31,668 bkt_1127711348.head

When a bucket file is partly empty due to deleted messages it is re-written.

New mesesages always go to bucket zero.

What advantages does it have

  • When accessing lots of little files the disk IO is greatly reduced, and the speed can thus be 2-4 times faster.
  • IMAP gets the most noticable speed improvement.
  • When backing up a mail partition the operating system has a much simpler job, this can make backup runs 4-14 times faster.
  • Some operating systems either fail completely, or run very badly when a disk has millions of files on it, this reduces this problem drastically.
  • If sharing a drive using NFS it should work as long as fcntl locking works on your NFS drives.

What disadvantagese does it have

  • It's a new feature which involved massive internal changes to surgemail, there is significant risk that bugs could exist in it.
  • It is a lot more complex than the 'file per message' model, so is more prone to bugs.
  • You can't manually examine a users mail box and modify files (although there are some commands to let you do this to some extent)
  • Message delivery is about 20% slower! (as the indexes are written at delivery time)

How do I turn it on ?

  1. Make a backup of your mail spool (or mirror it)
  2. Set the new setting g_maildir_netwin "true"
  3. Restart surgemail
  4. An automatic conversion process will start, in addition any mailbox which is accessed will be automatically converted.
  5. (You can turn it off the same way, change the setting and restart surgemail)
  6. DO NOT DOWNGRADE TO AN EARLIER VERSION OF SURGEMAIL AFTER CONVERTING :-)
  7. You can turn it on, on ONE member of a mirrored pair of surgemail servers.

Utility commands.

Command Decription
tellmail dir user@domain [folder] Show files in that inbox/folder
tellmail ndb_export user@domain foldername destination_path Export files to a directory
tellmail ndb_repair user@domain.name Repair index based on bucket files
tellmail ndb_convert Start convert process again