Due to one of our mail servers developing an ‘unresolvable hardware issue’ the project to consolidate the mail servers has been brought forward! We’ll be using an HP DL185 with 8GB RAM, 1 x QC CPU and a boat load of storage in RAID 6. This install will differ from our stock install in that we want to use Dovecot’s LDA with its indexing system to allow customers to utilise large mail boxes without performance degradation. We’ll be using the MBOX format which matches what we do already so no changes to our in house software and scripts will be needed. Dovecot will also serve as the POP3 and IMAP server.
Prelims
My server had been half prepared some time ago in preparation for this project so was running FreeBSD 8.1, so first job was to update it to FreeBSD 8.2, latest and greatest. I was pretty sure that i’d want quotas on the box so i added that to my kernel file. Once we had been through the process of cvsup, build and install world, build and install kernel, I installed portupgrade to bring all the installed ports into line, so a quick pkg_version -v now shows:
autoconf-2.68 = up-to-date with port autoconf-wrapper-20101119 = up-to-date with port automake-1.11.1 = up-to-date with port automake-wrapper-20101119 = up-to-date with port bash-4.1.11 = up-to-date with port bison-2.4.3,1 = up-to-date with port cvsup-without-gui-16.1h_4 = up-to-date with port cyrus-sasl-2.1.23_3 = up-to-date with port cyrus-sasl-saslauthd-2.1.23 = up-to-date with port db41-4.1.25_4 = up-to-date with port dovecot-2.0.13 = up-to-date with port gettext-0.18.1.1 = up-to-date with port gmake-3.82 = up-to-date with port help2man-1.40.4 = up-to-date with port libiconv-1.13.1_1 = up-to-date with port libtool-2.4 = up-to-date with port m4-1.4.16,1 = up-to-date with port p5-Locale-gettext-1.05_3 = up-to-date with port perl-5.12.4_1 = up-to-date with port portupgrade-2.4.9.3,2 = up-to-date with port ruby-1.8.7.352_2,1 = up-to-date with port ruby18-bdb-0.6.6 = up-to-date with port sendmail+tls+sasl2-8.14.5 = up-to-date with port
Setting up the Quotas
Every time I do this I refer to the FreeBSD handbook page here: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/quotas.html which pretty much covers how to do it all. Happily (yet with added complication) I’m using a GPT booted machine to maximise the capacity of the drives so the df -h output shows:
Filesystem Size Used Avail Capacity Mounted on /dev/gpt/boot 97G 4.6G 84G 5% / devfs 1.0K 1.0K 0B 100% /dev /dev/gpt/data 5.2T 2.8G 4.8T 0% /data
I used Dan’s (not me, another one!) excellent guide on how to do this which you can get here: https://www.dan.me.uk/blog/2011/01/10/booting-freebsd-from-gpt-for-large-disks/. So I’ve got my 2 partitions, boot and data and I’ve added quotas to the data partition only. My experience says that symlinking and quotas are not happy bedfellows so i’ve used dovecot’s LDA to reroute the traditional /var/mail/$username to /data/mail/$username and the home directories are set up as /data/home/$username/ so here is my /etc/fstab
/dev/gpt/boot / ufs rw 0 0 /dev/gpt/data /data ufs rw,userquota 1 1 /dev/gpt/swap none swap sw 0 0
And this is what i put into my /etc/rc.conf
enable_quotas="YES" check_quotas="NO"