Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
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
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
2  
So I'm going to use it. –  crazybyte Dec 10 '09 at 19:23
show 6 more comments

5 Answers

up vote 9 down vote accepted

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.

share|improve this answer
    
no swap then? if you were to use swap would you put that in the LVM or as a separate primary partition? –  quack quixote Dec 10 '09 at 18:54
    
Yes, I would use a swap and I would put it in the LVM. –  Swoogan Dec 10 '09 at 19:21
    
I looked into LVM and played with it a bit. It allows to have amazing flexibility in setting up the system. Thank you Swoogan! –  crazybyte Dec 10 '09 at 21:54
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
    
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
add comment

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.

share|improve this answer
    
Of course, monitoring will be a mandatory to be sure to avoid problems. –  crazybyte Dec 10 '09 at 18:01
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.