Unless you have a pre-installed Debian server you should instead do the installation yourself. This gives you a better choice on the disk partitioning and choice of file systems. Just skip this chapter if you have no console access or (re)installation from scratch is not an option.
As a general guideline your system should have at least 2 GB of RAM and lots of disk space living on a hardware-based RAID controller. Users will collect a lot of mails with a lot of useless attachments. And don't expect them to clean up their inbox - especially when offering IMAP. Project a 500 GB disk for 100 users. Regarding the CPU load there is mainly spam and virus scanning which is using up computing power. A quad core system will probably handle around 5-10 emails per second. If you don't need spam checking then a smaller CPU will also do.
Btw, I have created a quick screencast covering the first steps and especially the partitioning of the server with the logical volume manager. If you get stuck somewhere please watch this partitioning video screencast. (OGG video format)
Insert a boot medium (e.g. CD 1, Netinst-CD or DVD 1) and boot the system. You should see the splash screen:

Just choose "Install".
You will next get asked to choose the default language used for your system.

Always use "English" here even if your native language is something else. Otherwise system processes may write non-english log messages which may cause problems in automatic scripts. Besides you may look for help on the internet and will get better help with the english messages.
Continue with sensible choices until you get to the partitioning menu:

Choose "Manual" here so you get the option to use the logical volume manager. The logical... what?
Logical volume manager (LVM) in a nutshell
It is strongly suggested that you choose to use the LVM (logical volume manager) here. It scares many system administrators but it's not half the black magic you might expect. Besides Debian does the initial setup for you anyway. These are some of the advantages you would gain from using LVM:
- You can create partitions that span several physical hard disks. (Keep in mind that without a proper hardware RAID controller and redundant disks each physical hard disk may become a "single point of failure".)
- You can extend partitions (make them larger) without repartitioning or even unmounting a file system. Your file system is full? Just enter two commands and there is free space again. This is invaluable!
- You don't have to decide on how much space each partition may need later. Start small and extend as you see need.
This is LVM vocabulary you will stumble upon:
- physical volumes (PV): actual hard disk partitions like /dev/sda1
- volume groups (VG): you can combine PVs to get more space than one disk could hold
- logical volume (LV): a logical partition made up from parts of a VG - this is where you put your file systems on
- physical extents (PE): LVM manages your physical volumes in chunks of 4MB; so your volume group will always be a multiple of 4MB in size
To sum up: you take a few classical partitions (PVs), combine them into something larger (VGs) and finally take parts (PEs) of that large space to get logical partitions (LVs) where you put your file systems on. A quick diagram may help visualize this. First a typical mail server partitioning without LVM:

As you can see the partitions and their sizes are fixed. If you need more space on "/" later you are screwed and have to copy everything to a new disk thus creating a major downtime of your mail server. With LVM this could rather look like this:

In the above example you have two physical hard disks /dev/sda and /dev/sdb. Booting from an LVM partition is in theory possible but it's recommended you have a boot partition on its own. So /dev/sda1 is a classical small ext2 or ext3 partition. /dev/sda2 and /dev/sdb1 are partitions of type 8e (Linux LVM). These two partitions are the physical volumes that provide the actual physical space where data is stored. They are aggregated into a volume group that is called "vgmain" here - it's just an abitrary name. Now this volume group is divided up into logical volumes that are partitions that you can put file systems on and mount as usual. The logical volume called "lvvar" will later appear in your system as /dev/mapper/vgmain-lvvar and can be used just like a physical partition. And you still have 537 GB left for later use in this example to extend either / or /var if you lack space there.
(If you are still not yet sure if you understood the LVM then there is another nice explanation at tuxradar.)
Setting up the partitions
Anyway. You chose "Manual" before and should now see a screen similar to this (your hard disk will hopefully be larger than 8 GB):

Go down to the "FREE SPACE" line and press Enter. Let's start with /boot. Choose to create a new partition. Make it at least 100 MB. You will now be asked how to use this new partition:

Set the options as shown above. It should be ext2 or ext3, mounted at /boot and be bootable. Then choose "Done setting up the partition". You will be sent back to the overview of your partitions and can see your new /boot partition:

Set up all remaining space as "physical volume for LVM" as in:

Now that you created a physical volume there is a new option "Configure the Logical Volume Manager" in the overview:

Select this option and after a quick confirmation dialog (choose "Yes" there) you will enter the LVM configurator:

Create a volume group
Create a (new) volume group and give it a name. For example call it "vgmailserver" (the "vg" makes it clearer later that this is a volume group). You will get asked which physical volumes this volume group is supposed to consist of - select them.
Create the logical volume for / (root)
Now use this volume group to "Create a logical volume" and select your volume group (vgmailserver) to contain it. Give the new logical volume an explanatory name like "lvroot" (the "lv" makes it clear that it's a logical volume). Make it 2 GB large. This partition will later hold your basic operating system binaries.
Create the logical volume for swap
Even if you have a lot of RAM you should create a swap partition. It will be used to swap out parts of your memory that are not actively needed. The freed RAM can automatically be used as disk cache then. Create another logical volume "lvswap" as a swap partition and make it 1 GB. (If your system starts to swap like crazy then either you have too little RAM or something is going wrong and more swap wouldn't save you anyway. Note: a decent mail server has at least 2 GB RAM.)
Create the logical volume for /var
This partition is where your database (/var/lib/mysql) and mail directories (/var/vmail) will be stored. You will likely need to extend this partition later. So create another logical volume "lvvar". Unless you already know how much space you need just start with 2 GB.
(If you want to earn extra points here you should create seperate logical volumes for /var/lib/mysql and /var/vmail. This allows quick MySQL backups by locking the tables, making an LVM snapshot and backing up the raw files safely. This is much faster than the old-school way by using mysqldump. You can as well set the "noatime" mount flag on /var/mail to save an extra write access on every read access to an email. And you can decide whether you want to create a logical volume for /tmp or - if you have enough RAM - use a tmpfs for it. Keep in mind that virus scanning takes place in /tmp so don't go penny-pinching here.)
LVM configuration is done
In the "Partition disks" dialog you can choose "Display configuration details" and verify that your LVM configuration looks like this:

Finish the LVM configuration and the logical volumes will be shown in the overview:

All there is left to do is format the logical volumes. Format "lvroot" using an XFS file system mounted at "/". And format "lvvar" as an XFS file system mounted at "/var". Finally set up "lvswap" as a swap area.
XFS, ReiserFS or ext3?
There are different file systems available and many people seem to use ext3 nowadays. XFS, ReiserFS and Ext3 are journaling file systems. It's just that ext3 does not seem to trust its journaling much because after a number of mounts or a certain time span and a reboot it does a full file system check! That doesn't sound too bad? In real life that means that if after half a year of running your mail server if you need to reboot it then get a pot of coffee because this check can easily take hours or - in worse cases - days. This is obviously totally unacceptable. That automatic file system check can be disabled but it is discouraged.
Be aware that XFS has disadvantages, too. One disadvantage of XFS though is that existing partitions can only be extended but not shrunk. XFS is also dangerous if your server dies suddenly due to its write caching. So battery-backed write-cache or an uninterruptible power supply (UPS) is strongly recommended. If these disadvantages scare you then an alternative to XFS may be ReiserFS.
Done with the partitioning
If all is done the partitioning should look like this:

Admittedly this was a lot of work. But this time was well-invested. If later you need more space in any of these partitions you don't even have downtime. For example if you need 10GB more space in /var you would issue these two commands:
- lvextend -L +10G /dev/vgmailserver/lvvar
- xfs_grow /var
(Btw, you may want to create a rescue CD like with "grml" in case something goes wrong later and you need to get your data back from an LVM partition. Boot the CD with "grml lvm" and your logical volumes are automatically activated so you can mount them.)
1 Comment
Make risks more clear
Submitted by Anonymous (not verified) on
You already mentioned, but to make one point clear: one should - at least - use raid 1, even a software raid1 with mdadm - to protect against a single damaged disk. I live happily with such a configuration and survived two headcrashes :)