Created by: ston1th 2019-05-29 18:16:03
Updated by: daniel 2020-01-18 11:49:13
Visibility: Public

Overview

This document describes how to configure a NAS (Network-attached storage) on an OpenBSD system.

It’s expected that you already have a working OpenBSD instance, if not read the setup guide OpenBSD first.

RAID

First of all have to create a RAID.

TBA

NFS share

sysctl.conf

Optimized for NFS usage

cat <<EOF>> /etc/sysctl.conf
kern.maxfiles=25600
kern.maxfilesperproc=16384
net.inet.tcp.sendspace=65536
net.inet.tcp.recvspace=65536
EOF

TimeMachine Backup

It’s possible to write the TimeMachine Backups to the OpenBSD NAS with the Netatalk service. These setup is configured to share one afp-share which can be mounted as TimeMachine Backup-Disk.

Consider using the sysctl config from above.

Installation

pkg_add netatalk

Use netatalk version 3.x if you are asked from pkg_add.

Configuration

These services must be started.

rcctl start messagebus avahi_daemon netatalk

And you may want to start these services on startup.

rcctl enable messagebus avahi_daemon netatalk

Configure one user who has read and write access to the share and to the filesystem.

useradd -g _netatalk -d /var/empty -s /sbin/nologin _netatalk

In order to use password authentication both, the user and service password must be the same.

passwd _netatalk and afterwards afppasswd -c _netatalk

mkdir /var/timemachine && chown _netatalk:_netatalk /var/timemachine && chmod 770 /var/timemachine

After every configuration change you have to restart the service. rcctl restart netatalk

afp.conf

Be sure to set hostname to match the hostname of your server.

And afp listen has to match your servers IP address.

The rest should be self-explaining.

cat <<EOF> /etc/netatalk/afp.conf
;
; Netatalk 3.x configuration file
;

[Global]
hostname = nas 
mimic model = MacPro
log file = /var/log/netatalk.log
uam list = uams_dhx2.so

[TimeMachine]
path = /var/timemachine
hosts allow = 192.168.1.0/24
time machine = yes
vol size limit = 250000
valid users = "_netatalk"
file perm = 0640
directory perm = 0770
EOF

macOS configuration

You might need to execute the following command on your clients to get your share listed in the Time Machine preferences pane.

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Trivia

If you encounter weird question marks in the filename of the backup file, thats because per default the macOS hostname contains a apostrophe in the hostname and per default only ASCII characters are shown in OpenBSD. To solve that problem you can export LC_ALL to show UTF-8 characters. You may want to add this to your .profile to export this option every time you log in.

export LC_ALL=en_US.UTF-8