Thoughts on Linux server file system layout

I'm wondering and I'm sure that many out there are wondering also, on which would be the best or at least the optimal file system layout for a GNU/Linux based server. I'm aware that there is no general layout, because layouts vary based on what the final user want to achieve so I will narrow down my question to a very specific implementation. The purpose of the server is as mid size SIP telephony server. The file system layout that I came up with is the following:

The full size of the hard drive is 146 GB

  • 1 GB primary partition mounted as /boot
  • 16 GB primary partition mounted as /
  • 16 GB extended partition mounted as swap (the server has 8 GB memory and it won't get bigger soon at least)
  • 52 GB extended partition mounted as /var
  • 16 GB extended partition mounted as /var/log
  • 30 GB extended partition mounted as /usr
  • 5 GB extended partition mounted as /tmp
  • 10 GB extended partition mounted as /home

I put the swap in the middle considering that will allow faster access, made a big var partition because there will be a lot of variable data like database files. I moved the /var/log and /tmp into different partition to be sure that it they are filled they won't bring the entire system down and moved /usr also to be able to make it read-only if there is a need for such a measure. I made a small /home partition because the number of user will be low so there is no need for a big storage space the home directories.

There are many arguments for and against this layout I suppose and I'm curios (trying to pick the mind of the more experienced or wiser than me) about what are others thinking about so: is this fragmentation and order good considering fast access (that is why I put the swap almost in the middle), security and data safety? Any thoughts? Thanks!


Solution 1:

Two things:

  1. /boot only needs to be about 256MB, 512MB if you really want to be safe. How many kernels do you really need?
  2. For the love of [insert deity here] use LVM

In general I will use:

  • First primary partition 256MB /boot (ext2)
  • Second primary partition as physical volume (PV) in LVM
  • Logical Volume /
  • Logical Volume /home
  • Logical Volume /usr (optional)
  • Logical Volume /tmp (optional, prefer hdd over ssd)
  • Logical Volume /var (optional, prefer hdd over ssd)
  • Logical Volume swap (2 * RAM && <= 4GB)

Sizes depend on usage, but leave some (most) unused space in the volume group (VG) to expand any logical volumes that fill up.

Solution 2:

Definitely worth creating something like you've laid out, but I would consider using LVM and growing out your partitions as required.

Personally I use something very similar to what you have but the smallest partition size possible, since I have disk space monitoring on all my boxes in Nagios I know well in advance when I have to extend a partition.

Oh, and 1GB for /boot? Depending on your distro you shouldn't really need more than a few hundred megs...