A Novel about my FreeBSD journey

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

$: doas nano /etc/sysctl.conf =>

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

We are configuring the scheduler for desktop use

$: doas nano /etc/sysctl.conf =>

kern.sched.preempt_thresh=224

We are increasing the maximum number of files open

$: doas nano /etc/sysctl.conf =>

kern.maxfiles=200000

Boot time kernel tuning

$: doas nano /boot/loader.conf =>

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

Asynchronous I / O

$: doas nano /boot/loader.conf =>

aio_load="YES"

Thermal sensors

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


# AMD thermal sensors
$: doas sysrc -f /boot/loader.conf amdtemp_load="YES"

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

$: doas 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 used much). When we edit the /etc/fstab file, we add the noatime option:

$: doas 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:

$: doas tunefs -m X

We avoid creating a .core file

$: doas nano /etc/csh.login =>

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

kern.coredump=0

Discuss...