On Tue, Jun 4, 2019 at 3:34 PM Mogens Jensen <mogens-jen...@protonmail.com>
wrote:

> Can anyone with experience running OpenBSD routers without UPS, tell if
> filesystem corruption is going to be a problem after power outages, or
> if there are any officially supported ways to make the system resilient
> enough to not break after a power outage?
>
> I'm using an mSATA disk with MLC flash in the router.
>

I have some OpenBSD routers without UPS protection (Soekris net6501
devices) and
after using them for some years, I think it's not possible to have absolute
100%
protection from filesystem corruption due to power problems, without causing
other problems such as making the system overly fragile to upgrade or
maintain.

However, it works reasonably well to put /var/log on an MFS file system,
and set
up a cron job (as well as a line in /etc/rc.shutdown) to periodically rsync
/var/log
to another directory (so that logs will be preserved after a reboot).  This
works
fairly well, and the system comes up properly after power failures easily
over 98%
of the time.  Very rarely (i.e. I have seen it happen twice in a decade)
you will get
unlucky and have corruption anyway that requires you to run "fsck -y"
manually.
This is rare enough that I haven't bothered trying to automate it away.

To accomplish this, I installed OpenBSD with /var/log being a separate
filesystem,
then edited /etc/fstab to rename /var/log to /mfs/log, and add a new entry
for /var/log:

swap /var/log mfs rw,nodev,nosuid,-s=128M,-P=/mfs/log 0 0

Initializing the MFS /var/log by loading from /mfs/log, combined with an
rsync
command in /etc/rc.shutdown, is what gives the illusion of /var/log being
preserved
across reboots.

-ken

Reply via email to