Friday, February 23, 2007

Partitioning disk for FreeBSD server

In this article I wish discuss some ideas about partitioning hard drive, when preparing PC for being FreeBSD server. For server install it's necessary to make it as tight as possible.

When installing system, which main purpose will be running a few services - say, SMTP server or http proxy server, I prefer to use following partitioning:


swap - 2xRAM size, but not more than 1-2Gb
/tmp - 1-2Gb
/ - 6-8 Gb
/var -
/home- 1-2Gb
/data-


Why do I put partitions in this order? It makes overall system performance better -- the closer to the center of HDD spindle -- the less is sector seek time, so partitions which need faster access -- swap and /tmp should go closer to the center of the disk.

The next partition is a root partition -- I prefer to put there a lot of space to hold /usr directory with /usr/src and /usr/ports unpacked, also leaving space for port compilation.

/var -- you should reserve there enough space for logs and mail queue and mailboxes. If you have system which should do intensive logging -- put there at least 8-10Gb.

/home -- if you will have some administrative users which should only monitor system, you can have /home partition pretty small - 1-2Gb, not more.

/data -- spare partition where you can move working directories of services. Or you can directly mount this partition under /usr/local -- especially if you run squid or apache, which by default use /usr/local/squid and /usr/local/www respectively.

This kind of partitioning allows you mount / in sync mode (you should put in fstab something like this

/dev/ad0s1a / ufs rw,sync 1 1


or even mount root filesystem in ro mode


/dev/ad0s1a / ufs ro 1 1


Mounting root filesystem in read-only mode will prevent corruption and allow system to boot under any circumstances.

Negative sides is that users won't be able to change their passwords on their own and that you should remount it in r/w mode each time when you change system confguration.





Interesting article on disk seek times and etc -- http://www.logicsmith.com/seektime.html

No comments: