One can use its server to store important files.

In any case, you also must think to backup the server itself. You never know when the hard drive will crash, when a storm will generate a power overload or when your cat will rush trought the wires 😼.

Automatic backup of /

By default, you can backup / daily with OpenBSD

See The official FAQ about /altroot

If one day the main hard drive has a failure, you can boot on the /altroot. When you see the prompt "boot >" :

Find the /altroot partition

boot > machine diskinfo

Then boot on the appropriate slice :

boot > boot -s hd1a:/bsd

⚠ WARNING : only / is saved, with /etc. If you need to backup /var or /usr/local or else, you must plan this. Read the next part to do so 😉.

Read also the official FAQ to duplicate filesystems.

More backup


You may dedicate a partition to your backup, wether it's an external drive or an extra slice kept at OpenBSD install. Below, we use as example the mount point /mnt/bckp created for our needs.

We will use the "rsync" tool. You can install it throught ports, but take note there is "openrsync" already available in base install. It is a rewrite of rsync less powerful but at least avaiable in base. If the target device doesn't have rsync installed, add the option "--rsync-path=openrsync". The rsync protocol will detect modified or new files to copy and don't bother with the others.

As example, you can add those lines in /etc/weekly.local file to backup /var and /usr/local well, weekly :

/usr/local/bin/rsync -a --delete /var/ /mnt/bckp/var.bak/
/usr/local/bin/rsync -a --delete /usr/local/ /mnt/bckp/usrlocal.bak/

This is a local backup, but you can use rsync thought a SSH tunnel to send data from one computer to your server:

$ rsync -e "ssh" -avz --delete /directory/to/backup \


Tar let you create archives of a whole directory structure, and is available in base of course.

Below is a suggestion to create a daily archive named with the current date.

for i in $BACKLIST; do
    backupfile="${BACKDIR}/$(basename ${i})-$(date +%F).tar.gz"
	tar -czf "${backupfile}" "${i}"
chmod 700 "${BACKDIR}"
# remove olds
#find "${BACKDIR}" -type f -mtime +90 -delete

Uncomment the last line to delete achives older than 90 days.