A
A
artyvr2014-09-02 20:24:10
Iron
artyvr, 2014-09-02 20:24:10

How to properly partition a disk for a web server (linux)?

There is a task to organize a web server ( debian / centos ) for internal use (the load is small 3-4 sites php + MySQL / MariaDB ), how to partition the HDD correctly , I read that it is worth taking out from the root into separate sections /boot, /home, /tmp , /var , and what volume to allocate for each section , maybe there is some kind of percentage or ideal that you should strive for? Still interested in the partition file system, I heard that for partitions where crash recovery is not critical, /boot for example, you can use fs without journaling, does this make sense?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Igor, 2014-09-03
@merryjane

/boot is a separate partition. Without LVM.
From the rest of the free space you make LVM. Move /var/log, /var/www, /var/lib/mysql to separate volumes . These are the main directories for the web server. There is no need to allocate all the space for them at once. Better make a minimum, and leave the remaining free space in LVM (you can always add where you need).
The file system I recommend is ext4, as it is very reliable and time-tested, or xfs, as it is newer. You don't need to disable the log, it's better to tune the mount options, for example, add noatime, nodiratime, nobarrier .

S
s1dney, 2014-09-02
@s1dney

If you yourself do not know how much space you need for your tasks /var, /boot, etc., then you don’t need to deviate from the automatic markup that the installer offers, don’t create problems for yourself.
/boot is usually set to ext2, since the lack of journaling has a positive effect on performance
/tmp in modern systems is mounted in tmpfs (ram), because modern memory sizes allow this and a slight decrease in io on the disk has a positive effect on performance and working resource (especially relevant for ssd)

L
Lolshto, 2014-09-02
@Lol4t0

Sometimes it is recommended to allocate /var/log to a separate disk so that the logs do not fill up all the space at the expense of data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question