Linux Server Partitioning – How Many and Which Partitions to Create

linuxpartitionunix

Partitions are very important on Linux server because it give you a lot of flexibility, for example when upgrading to a bigger hard drive.

But, how many partitions should I create when building a Linux box ?
Which size should I set for each partition ?

At last but not least, which partitions should I have on a separate disk (I'm thinking about /home, /var on perhaps a quicker drive, etc) and which partitions may I share on same drive ?

Best Answer

Planning a good partitioning structure is heavily dependent on actually knowing how you are going to use the 'server'. Any random advice that doesn't take the actual services that will be provided isn't going to be particularly useful.

For example if it is a debian-based box that will be used for mysql you might want a seperate partitions for /,/var, and /var/lib/mysql.

Is it going to be a file server with lots of shared storage? You might want a /, /home, and /srv partitions.

For a box running only squid, you might want on partition for /, and one partition on a fast disk for the squid spool.

As you are planning your partitions it is very helpful to have a good understanding of the Filesystem Hierarchy Standard and if/how your chose distro deviates from the standard.

Using LVM can make it much easier to change your mind in the future and adjust your partitions without having to reboot., and its ability to create snapshots can be very easy to create good backups.