用 bsdlabel(8) 或 sysinstall(8) 來規劃檔案系統時,請記住: 硬碟在傳輸資料方面,(由於結構為碟片因素)外圈會比內圈來得快些。 因此,建議把較小、常會存取的分割區儘量放外圈,而較大的分割區像是 /usr 則應放在較內圈。 建議建立分割區的順序,以像是:root, swap, /var, /usr 這樣順序來建立會較妥。
/var 的大小要視機器的用途而定。 /var 是用來放 信箱、log 紀錄檔以及印表機佇列(spools)。 信箱以及記錄檔的成長幅度可能無法預估, 因為這些成長幅度乃是取決於多少用戶、要放多久等管理原則而定。 通常這些使用者並沒有用到 1 GB 以上,但請切記:至少要保留一定空間給 /var/tmp 以便存放 packages。
而 /usr 分割區主要是用來放系統運作時所需的檔案、工具程式等,例如: ports(7) collection(建議安裝)跟 source tree(optional)。 在安裝 FreeBSD 時,這兩者都是可選擇裝與不裝的。 不過,這個分割區建議至少要有 2 GB 空間以上才夠用。
規劃分割區大小時,記得多保留些成長空間。 否則若某個分割區滿了,但另一個分割區卻還剩很多空間,就會相當困窘。
Note: 有些人可能會發現 sysinstall(8) 的 Auto-defaults(自動預設值) 所做的分割區大小, 有時候會把 /var 以及 / 分割區設太小了。 我們建議是:請依使用情況以及需求,來手動調整相關分割區大小。
根據經驗法則,通常 swap 分割區應該設為系統記憶體(RAM)大小的兩倍即可。 舉例來說:若機器有 128 MB RAM 的話,那麼 swap 則應該設為 256 MB。 Systems with less memory may perform better with more swap. Less than 256 megabytes of swap is not recommended and memory expansion should be considered. The kernel's VM paging algorithms are tuned to perform best when the swap partition is at least two times the size of main memory. Configuring too little swap can lead to inefficiencies in the VM page scanning code and might create issues later if more memory is added.
On larger systems with multiple SCSI disks (or multiple IDE disks operating on different controllers), it is recommend that a swap is configured on each drive (up to four drives). The swap partitions should be approximately the same size. The kernel can handle arbitrary sizes but internal data structures scale to 4 times the largest swap partition. Keeping the swap partitions near the same size will allow the kernel to optimally stripe swap space across disks. Large swap sizes are fine, even if swap is not used much. It might be easier to recover from a runaway program before being forced to reboot.
Several users think a single large partition will be fine, but there are several reasons why this is a bad idea. First, each partition has different operational characteristics and separating them allows the file system to tune accordingly. For example, the root and /usr partitions are read-mostly, without much writing. While a lot of reading and writing could occur in /var and /var/tmp.
By properly partitioning a system, fragmentation introduced in the smaller write heavy partitions will not bleed over into the mostly-read partitions. Keeping the write-loaded partitions closer to the disk's edge, will increase I/O performance in the partitions where it occurs the most. Now while I/O performance in the larger partitions may be needed, shifting them more toward the edge of the disk will not lead to a significant performance improvement over moving /var to the edge. Finally, there are safety concerns. A smaller, neater root partition which is mostly read-only has a greater chance of surviving a bad crash.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.