8

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!

crazybyte
  • 337
  • 1
  • 3
  • 10
  • 8
    I'm not going to post this as an answer, but... I've been bitten enough times by overpartitioning that I'm a big fan of using as few partitions as absolutely necessary. The rationale behind partitioning a Linux system this way feels rather dated. – Boden Dec 10 '09 at 17:46
  • 6
    Why not use LVM and grow the filesystems as necessarily? – Cristian Ciupitu Dec 10 '09 at 18:13
  • If you are interested in the philosophy behind more/less partitioning, see this question: http://serverfault.com/questions/61284/sell-partitioning-to-me – David Mackintosh Dec 10 '09 at 18:34
  • IMHO LVM would complicate things and would also introduce an unnecessary failing point. – crazybyte Dec 10 '09 at 18:51
  • Note that you won't have separate "extended" partitions; all the partitions you've so marked will be (or at least *should* be) **logical partitions** residing in a single **extended partition**. – quack quixote Dec 10 '09 at 18:56
  • 1
    It's already complicated. The snapshot and growth capabilities of LVM will make your life easier in the long run. – Ophidian Dec 10 '09 at 19:05
  • Ah yes, I expressed myself badly. They are logical partitions. I'm looking into LVM. – crazybyte Dec 10 '09 at 19:05
  • 2
    How is LVM a failure point? – Aaron Brown Dec 10 '09 at 19:16
  • 3
    I think you're overpartitioning, personally. Also, I'd go with LVM. It's ready for production, and will either sit there forever or save your bacon later. – pboin Dec 10 '09 at 19:20
  • I don't have much experience with using LVM so I was thinking about the fact that it is another abstraction layer and if something happens then it will be harder to repair, but now I understood that it is more flexible and a better solution. – crazybyte Dec 10 '09 at 19:23
  • 2
    So I'm going to use it. – crazybyte Dec 10 '09 at 19:23

5 Answers5

10

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.

Swoogan
  • 2,007
  • 1
  • 13
  • 21
1

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...

thehatter
  • 51
  • 1
  • 4
0

I generally agree with your approach of splitting the disk into multiple filesystems. I'm not sure if putting swap in the middle really does anything for you. I would concentrate on making sure that all the partitions are large enough for the intended tasks. For example, what is the risk that your 16GB /var/log will fill up? On a standard linux server that should be plenty of room for logs, but a specialized server might have create much larger logfiles based on usage.

You might consider increasing the size of /tmp in case any of the software you are using wants to make a lot of large tempfiles.

My main recommendation would be to use this sort of approach for filesystem sizes, but concentrate on doing proper monitoring and log file rotation to ensure you don't fill up those critical /tmp and /var/log filesystems.

Phil Hollenback
  • 14,647
  • 4
  • 34
  • 51
  • Well, I'm not aware of the fact that the SIP server software will use or make lot of temporary files or big temporary files, but like you said better to be safe than sorry. Also there won't be a lot of logging going on from the part of the server. Some data like CDR's or database files will reside in another directory in /var and those could be quite large that is why I figured that should have a big size. I will look into it to be sure that the space for /tmp and /var/log is big enough and also I will use proper log file rotation thats for sure. Thanks for the advice! – crazybyte Dec 10 '09 at 17:56
0

I myself probably wouldn't have split it so heavily; you're going to have issues if any particular partition fills up, and you've made it so that you've got ~6 that could fill up and cause problems, and it's a new system, so you really don't know for sure where space is going to get tight.

Make sure you set up alerts for when available space gets low.

Satanicpuppy
  • 5,917
  • 1
  • 16
  • 18
0

I wouldn't bother splitting off a 30GB partition for /usr. 16GB is a reasonable size for / and /usr combined; give your root partition 20-30GB if you really want the room.

I don't have much experience with LVM, but with your proposed usage it makes sense.

It really sounds like you should do a trial installation first, to suss out exactly what your space requirements will be for the basic system and software. Especially if you'll be avoiding an LVM solution. Once you've done that you'll have a much more solid idea of how big your / and /usr partitions must be. You can then adjust your partition sizes to maximize the available space for the areas you expect to need them -- /var, /var/log, and /tmp.

quack quixote
  • 1,665
  • 14
  • 17