Home -- Tutorials -- Quickies -- Manual Pages -- Search -- Feedback -- About The Site -- Forum
Optimization tips for your FreeBSD 2.2.x and 3.x system
added 8.5.1998 -- written by Perlsta


Article Description: Some simple optimization tips for your IDE hard drives and kernel.
If you have IDE hard drives, the first two tips may help improve performance.

What you can optimize.How to optimize itWhy/What does this do?Caveats / Dangers
IDE hard drive access.Enable DMA and multi-sector operations on your IDE drives.

  1. at the booting prompt type '-c' to configure your kernel.

  2. Enter the visual mode by typing "visual" at the prompt.

  3. type this string into the "flags" option for your IDE controller:
    "a0ffa0ff"
FreeBSD uses conservative access to your hard drive, this means it does not attempt to use DMA or bus mastering, and it doesn't take advantage of the pseudo scatter/gather options supported by IDE.

These flags enable FreeBSD to do use these optimizations.  You will experience much lower CPU usage during disk access. While compiling my kernel 40-60% of my CPU went towards servicing the IDE drives / controller, now only 3-7% is, this really helps in multitasking.

I am unfamiliar with the damage that could be done on drives that don't support these options, however it seems to me that FreeBSD will "fall-back" to a less efficient access method if the hardware doesn't support it.
File system accessMount your partitions "async" you can do this by typing the the following line for already mounted file systems or editing your /etc/fstab file appropriately.

mount -u -o async /mount-point

This tells FreeBSD to cache not only file read and writes, but also directory entry read and writes.This is the default on Linux systems.

What it does is that normally all modifications on directories are committed immediately to disk, therefore deleting a large directory tree with many files will take an absurd amount of time without this option.

On the other hand, if a crash occurs and the directory entries are not updated correctly you risk losing a LOT more data, (i.e. every file in the directory and those directories underneath it) so use backups or be prepared to replace all lost data.

to turn this option off:

mount -u /mount-point

Your kernelGo through your kernel configuration files and delete controllers that are not in your system, also hardcode in values for devices so if you ever make the kernel again, it will remember.

You will have to install / download the FreeBSD kernel source.

Read the LINT kernel in /usr/src/sys/i386/conf/LINT

This will make your kernel "lean and mean".

Also by commenting out compatibility for older processors you will enhance the speed of the kernel and all of its operations, a definite plus!

If you don't so this correctly you might wind up with a system that doesn't boot correctly or boot at all!
© Copyright 1998-2008 VANGEYN.Net, unless otherwise noted.