Linux – the recommended partition setup for a web server

debianlinuxpartitionweb-hostingweb-server

I am going to be running a web server using Debian which has 2 x 4 TB (8 TB total) drives in RAID 1. This server will be used for running websites, email and file storage.

From doing my research I am still really confused on how to setup my partitions, I really want to get it right before I continue. But all the past posts about this are like 7 years old.

I would prefer to have /boot and swap on their own partitions, then just have one big partition for the rest. I've read about /tmp /var/log all filling up and going wild… is this still something I should worry about?

I have heard of LVM but I don't like the idea of having to keep allocating drive space when needed, I would rather have all my HDD space available from the start and not have to worry about allocating new space at some point in the future.

For now I currently went with this:

PART swap swap 8G
PART /boot ext3 800M
PART / ext4 all

I'm not sure if this is a good setup for my server, am I "partitioning myself into a corner"?

Is there anyway in which I can restrict folders such as /tmp and /var/log without setting size limits with partitions?

Best Answer

Here's what I would suggest.

  • Don't worry about how much swap. Sure, have some, like 1G. More importantly, never ever let your box need to use swap. If it does, your server is going to grind to a near halt, and your users will tar and feather you.
  • You're going to want a separate partition for your web server logs (eg /var/log/httpd) so if it fills all the way up, your whole server doesn't puke.
  • Use LVM and leave a fair amount of space unallocated. Your reluctance to use LVM is probably misguided. Then you can allocate that space later. EG more to /home if you have greedy users, more to /var/log or /var/log/httpd if you want to keep lots of logs, etc... It's generally better to leave space unallocated than rely on your long-term predictions. Make your predictions, and allocate space, for sure, but try to keep some in reserve.
  • (this is more philophical than practical) Follow the middle path between planning and reacting. Your ability to predict your future needs will never be very good. Plan as well as you can, but keep as much flexibility as possible. LVM lets you do this.
Related Topic