On 5/20/24 09:37, Jan Stary wrote:
On May 20 13:22:26, mikyde...@yahoo.fr wrote:
Hello,
I have two use cases and problems with fsck.
1) When my openbsd boots after an outage, the system asks me to fsck /, /usr,
/var or /home manually.
So I do
fsck /dev/sd0a
And then I'm asked questions and I usually answer F
So my question is that I want this process to be done automatically at boot
time for each partition that has a problem.
The /etc/rc boot script calls fsck -p;
if that fails, it means fsck -p was unable to fix a major problem.
It is the point that it requires an admin's intervention.
You would have to change the fsck call to fsck -y;
but don't do that.
I'd look at why your file systems are always needing these manual
interventions after a hard shutdown. I routinely power down my
personal systems with yanking the power cord if it would take me
longer "properly" connect a console and properly shut down.
yeah, I get fscks, but I rarely get a manual intervention required.
It does happen...but rarely.
(Also, don't let a server have power outages, obviously.)
This is because I use a small server without screen and keyboard.
So what? That is no excuse to leave broken filesystems unattended.
2) I have another disk in my small server, and I mount one partition of it with
in fstab
aa929243b0f59999.a /var/mylogs ffs rw,nodev,nosuid 1 2
When I remove that disk the boot sequence stops and asks for a fsck
I would like that this disk is mounted when it's present, but when it's not
installed I don't want the boot sequence to stop
Make it also "noauto" in fstab and mount it in rc.local.
Last I tried this, it didn't do what I wanted -- "noauto" still expects
to have the disk there and will fsck it on boot. Failure to be able to
do this stops the boot. It's been a while since I last tried this, so
perhaps something has changed (including my recollection?)
I have some backup servers with big file systems that can take hours to
fsck. I pulled the mount lines out of /etc/fstab and put them in a
separate script that is invoked at boot from /etc/rc.local
And this might be a solution for the OP's problem:
make /usr and /usr/* "ro" during normal operation, and move all the
"lots of volatile data" stuff over to partitions that are mounted post
boot by a separate script. Maybe make /tmp an MFS if that's an option.
That will minimize the fsck problems, and allow the system to come up
for either manual, remote fixing or even fsck -y in the mountall script.
Don't forget you ro'd the /usr partitions, otherwise your upgrades will
be unpleasant. :)
Nick.