Adding more cpu cores to OpenBSD.

tldr; Boot bsd.mp

I recently received a notice from Hetzner, regarding another price adjustment for legacy instances (CX11 - 1 vCPU/2GB RAM/20GB disk). The price adjustment was essentially the same as the flat rate for a CX22(2 vCPUs/4GB RAM/20GB disk). Given this I decided to perform a rescale to match the resources I’m paying for.

I got this VPS on 2018 and transitioned to running OpenBSD 6.5 on 2019. Since then, a lot have changed, apart from the OS, currently on latest version. The rescale part was pretty straightforward: Selected the new tier, powered off the VPS, performed the rescale to get the additional core and memory and finally boot.

Upon booting with the primary bsd kernel the newly added memory was identified, but no additional cores were available. As it seems OpenBSD on installation detects the cpu count and uses a multi-processor(bsd.mp) kernel or a single-processor(bsd.sp) accordingly. In this case only the bsd.sp was installed.

Easy way

The easiest solution to resolve this, is to perform an upgrade(U) using the ramdisk(bsd.rd) kernel. In boot prompt, issue boot /bsd.rd. Ramdisk kernel offers several choices, we choose to upgrade. Performing the upgrade correnctly identifies the >=2 cpu count and includes the bsd.mp in the listed installation sets. Every other response to the installer should be the preselected defaults. After the upgrade the installer will reboot and choose the default kernel which is now bsd.mp, essentially copied over to /bsd.

After that:

dodoni# sysctl hw.ncpu                             
hw.ncpu=2
dodoni# sysctl hw.ncpufound
hw.ncpufound=2

Manual way

Note to self, the manual way would be:

sha256 -h /var/db/kernel.SHA256 /bsd

related info from OpenBSD’s manual upgrade instructions