Optimizations for FreeBSD

With this tutorial, I will explain to you how we can make our FreeBSD a little faster and optimize it for desktop usage.


Extend X11 interface for shared memory

root: nano /etc/sysctl.conf =>

kern.ipc.shmmax=67108864
kern.ipc.shmall=32768

We are configuring the scheduler for desktop use

root: nano /etc/sysctl.conf =>

kern.sched.preempt_thresh=224

We are increasing the maximum number of files open

root: nano /etc/sysctl.conf =>

kern.maxfiles=200000

Boot time kernel tuning

root: nano /boot/loader.conf =>

kern.ipc.shmseg=1024
kern.ipc.shmmni=1024
kern.maxproc=100000

Asynchronous I / O

root: nano /boot/loader.conf =>

aio_load="YES"

Thermal sensors

# Intel Core thermal sensors
root: sysrc -f /boot/loader.conf coretemp_load="YES"


# AMD K8, K10, K11 thermal sensors
root: sysrc -f /boot/loader.conf amdtemp_load="YES"

Automatic fsck repair and fsck background (except for ZFS installation)

root: sysrc fsck_y_enable=YES

Deactivate the access time on our partition

By default, the time of access to files is noted, which can take time (and not use much). When we edit the /etc/fstab file, we add the noatime option:

root: nano /etc/fstab => 

#Device          Mountpoint    FSType  Options       Dump    Pass
/dev/gpt/ROOT    /             ufs     rw,noatime    1       1

Percentage of hard drive reserved

By default, FreeBSD reserves 8% of the hard drive for its system operations (defragmentation). If that's too much for us, we can change this value with this command:

root: tunefs -m X

We avoid creating a .core file

root: nano /etc/csh.login =>

limit coredumpsize 0
root: nano /etc/sysctl.conf =>

kern.coredump=0