How to install OpenBSD to Herzner server with NVMe without KVM nor VNC

Kirill A. Korinsky
4 min readDec 25, 2023

--

Let start from boot server into rescue mode and when download the installer

root@rescue ~ # wget https://cdn.openbsd.org/pub/OpenBSD/7.4/amd64/install74.iso

now is tricky part: let’s run it under QEMU with attached serial console. By default it boot without using serial console as default console. We have two option: custom installer or boot option. I’m a bit lazy to make a custom installer, so I’ve provided a boot options and use default boot settings by press Enter after switch the console.

root@rescue ~ # qemu-system-x86_64 -m 4096 -hda /dev/nvme0n1 -hdb /dev/nvme1n1 -cdrom install74.iso -boot d -net nic -net user -nographic -serial mon:stdio

Booting from DVD/CD…
CD-ROM: E0
Loading /7.4/AMD64/CDBOOT
probing: pc0 com0 mem[639K 3070M 1024M a20=on]
disk: fd0 hd0+* hd1+* cd0
>> OpenBSD/amd64 CDBOOT 3.65
boot> stty com0 115200
boot> set tty com0
switching console to com>> OpenBSD/amd64 CDBOOT 3.65
boot>
0
cannot open cd0a:/etc/random.seed: No such file or directory
booting cd0a:/7.4/amd64/bsd.rd: 3969732+1655808+3886664+0+708608 [109+444888+297417]=0xa76798
entry point at 0xffffffff81001000
Copyright © 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright © 1995–2023 OpenBSD. All rights reserved. https://www.OpenBSD.org

OpenBSD 7.4 (RAMDISK_CD) #1322: Tue Oct 10 09:07:38 MDT 2023
deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/RAMDISK_CD
real mem = 4278059008 (4079MB)
avail mem = 4144390144 (3952MB)
random: good seed from bootblocks

Now it’s booting and with your SSH session as console. Let switch to shell and make RAID1 over our NVMe.

Welcome to the OpenBSD/amd64 7.4 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? S

# cd /dev
# sh MAKEDEV wd0 wd1
# fdisk -iy wd0
Writing MBR at offset 0.
# fdisk -iy wd1
Writing MBR at offset 0.
# disklabel -E wd0
Label editor (enter ‘?’ for help at any prompt)
wd0> a a
offset: [64]
size: [3750748784]
FS type: [4.2BSD] RAID
wd0*> w
wd0> q
No label changes.
# disklabel wd0 > layout
# disklabel -R wd1 layout
# rm layout

# bioctl -c 1 -l wd0a,wd1a softraid0
sd0 at scsibus1 targ 1 lun 0: <OPENBSD, SR RAID 1, 006>
sd0: 1831420MB, 512 bytes/sector, 3750748256 sectors
softraid0: RAID 1 volume attached as sd0
# bioctl sd0
Volume Status Size Device
softraid0 0 Online 1920383107072 sd0 RAID1
0 Online 1920383107072 0:0.0 noencl <wd0a>
1 Online 1920383107072 0:1.0 noencl <wd1a>
# ^D
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/amd64 7.4 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?

Well, at installer we shoul use terminal type instead keyboard layout and vt220 serves well. The only tricky part is prevent redirect the default console to com0, which is yes with that setup by default. If you ignore it, the machine will never boot.

Change the default console to com0? [yes] no

Well, the next unusual step is used layout. I use NVMe a bit less than 2Tb that allow me to create one huge partition and use it as MBR boot device.

Available disks are: sd0 wd0 wd1.
Which disk is the root disk? (‘?’ for details) [sd0]
No valid MBR or GPT.
Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [whole]
Setting OpenBSD MBR partition to whole sd0…done.
The auto-allocated layout for sd0 is:
# size offset fstype [fsize bsize cpg]
a: 1.0G 64 4.2BSD 2048 16384 1 # /
b: 4.2G 2097216 swap
c: 1788.5G 0 unused
d: 4.0G 10977088 4.2BSD 2048 16384 1 # /tmp
e: 12.0G 19365696 4.2BSD 2048 16384 1 # /var
f: 30.0G 44465472 4.2BSD 2048 16384 1 # /usr
g: 1.0G 107380032 4.2BSD 2048 16384 1 # /usr/X11R6
h: 20.0G 109477184 4.2BSD 2048 16384 1 # /usr/local
i: 3.0G 151420224 4.2BSD 2048 16384 1 # /usr/src
j: 6.0G 157711680 4.2BSD 2048 16384 1 # /usr/obj
k: 300.0G 170294592 4.2BSD 4096 32768 1 # /home
Use (A)uto layout, (E)dit auto layout, or create ©ustom layout? [a] C
Label editor (enter ‘?’ for help at any prompt)
sd0> a a
offset: [64]
size: [3750748192]
FS type: [4.2BSD]
mount point: [none] /
sd0*> w
sd0> p
OpenBSD area: 64–3750748256; size: 3750748192; free: 96
# size offset fstype [fsize bsize cpg]
a: 3750748096 64 4.2BSD 8192 65536 1 # /
c: 3750748256 0 unused
sd0> q
No label changes.
/dev/rsd0a: 1831420.0MB in 3750748096 sectors of 512 bytes
561 cylinder groups of 3266.88MB, 52270 blocks, 104704 inodes each
/dev/sd0a (8c32cb4597fd17df.a) on /mnt type ffs (rw, asynchronous, local)

At the end it says

CONGRATULATIONS! Your OpenBSD install has been successfully completed!

When you login to your new system the first time, please read your mail
using the ‘mail’ command.

Exit to (S)hell, (H)alt or (R)eboot? [reboot] H
syncing disks… done

The operating system has halted.
Please press any key to reboot.

To switch to QEMU console just pres Ctrl-a c and type quite to exit:

^a c
QEMU 7.2.5 monitor — type ‘help’ for more information
(qemu) quit

Now you may reboot the server and enjoy OpenBSD :)

--

--

Kirill A. Korinsky

IT geek who loves to play with the data. Would like to contact me? Just drop an email to kirill@korins.ky