Jun 142011
 

In this tutorial I will describe how to set up postfix and maildir which can automatically replicate email when email is delivered. We will not touch the postfix configuration at all. we will manipulate maildir directory behavior using ChironFS, instead.

what is ChironFS?

This the Chiron Filesystem. It is a Fuse based filesystem. It’s main purpose is to guarantee filesystem availability using replication. But it isn’t a RAID implementation. RAID replicates DEVICES not FILESYSTEMS.

Things we need before installing chironfs

  • fuse
  • fuse-devel
  • fuse-libs
  • ChironFS source/binary from here

Compile ChironFS source

RPM:

$ rpmbuild --rebuild chironfs-1.0.0-1.fc8.src.rpm
$ rpm -ivh /path/to/chironfs-1.0.0-1.fc12.rpm


Tarball:

$ tar xvzf chironfs-1.0.0.tar.gz
$ cd chironfs-1.0.0
$ ./configure
$ make
$ sudo make install

Testing ChironFS

# mkdir /virtual-postfix-maildir /real-maildir1 /real-maildir2
# chown -R postfix:postfix /virtual-postfix-maildir /real-maildir*
# chironfs /real-maildir1=/real-maildir2 /virtual-postfix-maildir

Confirm they are correctly mounted with the command:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_fire-lv_root
                       72G   28G   41G  41% /
/dev/shm               72G   28G   41G  41% /var/tempfs
/dev/sda1             194M   22M  163M  12% /boot
tmpfs                 502M     0  502M   0% /dev/shm
/real-maildir1=/real-maildir2
                       72G   28G   41G  41% /virtual-postfix-maildir

Try to create/modify/delete some files in /virtual-postfix-maildir and check for the reflections in /real-maildir1 and /real-maildir2.

You can also set up your ChironFS to be mounted through /etc/fstab.

chironfs#/real-maildir1=/real-maildir2 /virtual-postfix-maildir	fuse	allow_other,log=/var/log/chironfs.log	0	0

You could also use a locally mounted ext3 filesystem and an others filesystem that is mounted to a backup machine over NFS or sshfs, and use ChironFS to make both filesystems store the same Maildir contents.

remote-host:/remote-directory		/real-maildir2		nfs	defaults	0	0
chironfs#:/real-maildir2=/real-maildir1	/virtual-postfix-maildir	fuse	allow_other,log=/var/log/chironfs.log	0	0

The colon before the /real-maildir2 in the fstab file tells ChironFS that this is a slower replica, so it will not try to read from the NFS filesystem. Because Chiron FS is a FUSE filesystem, you have to specify the allow_other option in order to let users other than the user who initially mounted the ChironFS have access to it.

On postfix main.cf configuration

virtual_mailbox_base = /virtual-postfix-maildir
important: this is just proof of concept, I’ve never really tried these settings on a production server. However, ChironFS itself, could actually replicate the contents of the directory.

good luck

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.