https://man.openbsd.org/release
dd if=/dev/zero of=mydisk.img bs=1 count=0 seek=2G
vnconfig mydisk.img
fdisk -iy vnd0
disklabel -E vnd0
add slice a with all the storage
newfs /dev/vnd0a
mount /dev/vnd0a /mnt/
cd /mnt/
tar zxvfph base67.tgz
cp /etc/resolv.conf /mnt/etc
cp /etc/installurl /mnt/etc
cd /mnt/dev/
./MAKEDEV all
#If you want to make it bootable copy the kernel
cp /bsd /mnt/
chroot /mnt/ /bin/sh
#Set root password
passwd root
#Create a fstab
#sd0a
# cat /etc/boot.conf
set tty com0
stty com0 115200
#cat /etc/ttys
#tty00 "/usr/libexec/getty std.9600" vt220 on secure
tty00 "/usr/libexec/getty std.115200" vt220 on secure
Good idea now is to bake a backup of the image.
Other good stuff to consider:
- Allow ssh?
- Create additional users?
- No network configuration has been made yet
Test the image
OpenBSD has vmd with vmctl that allows you to run a virtual machine easily.
vmctl start -m 1G -i 1 -b /bsd -d mydisk.img "myvm" -c
- m – memory
- i – #nr of interfaces (network)
- b – bios/kernel
- d – disk
- c – attach console after start