OpenBSD has a file system called mfs which stands for memory file system. It allows you to create an entire file system in memory (RAM). Since CompactFlash disk have a limited amount of write cycles we will use this feature to our advantage. We will create the following directories in mfs:
by adding the following lines to /etc/fstab:
swap /tmp mfs rw,-s=65536,nodev,noatime,noexec,nosuid 0 0
swap /var/log mfs rw,-s=131072,nodev,noatime,noexec,nosuid 0 0
swap /var/run mfs rw,-s=2048,nodev,noatime,noexec,nosuid 0 0
swap /var/tmp mfs rw,-s=16384,nodev,noatime,noexec,nosuid 0 0
As you have no doubt noticed the s switch in the mount options specifies the actual size of the mfs partition in 512 byte blocks. Hence 65536 are actually 32 megabytes.
We specify a few additional security and performance options:
nodev no device files will be interpreted
noatime the access times of the files won't be updated
noexec no executable files on this file system
nosuid Ignore set-user-identifier and set-group-identifier
These partitions will be mounted on top of existing directories and the original content will not be accessible unless the mfs file systems are umounted.