Bug 178818 - gmirror savecore support / gmirror(8) says to use rc.early which is no longer available
Summary: gmirror savecore support / gmirror(8) says to use rc.early which is no longer...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Some People
Assignee: freebsd-rc (Nobody)
Keywords: feature, needs-patch, needs-qa
: 190152 (view as bug list)
Depends on:
Reported: 2013-05-21 19:20 UTC by Lawrence Chen
Modified: 2021-02-23 08:58 UTC (History)
9 users (show)

See Also:
koobs: mfc-stable12?
koobs: mfc-stable11?

gmirror(8) manpage patch (4.92 KB, patch)
2019-06-12 01:26 UTC, Christian Baltini
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lawrence Chen 2013-05-21 19:20:00 UTC
	gmirror(8) has NOTES section on doing kernel dumps to gmirror
	providers and wanting to use a different balance algorithm through use
	of /etc/rc.early and /etc/rc.local.

	But, /etc/rc.early is no more.


Provide an alternative solution to /etc/rc.early, such as create
	an equilavalent /etc/rc.d/early? create some other /etc/rc.d/<file>
	that is "BEFORE: dumpon"?  Some other way?

	Plus the original early script wouldn't work, since it would get called
	after dumpon.  Since it is "REQUIRE: disks" while dumpon is
	"BEFORE: disks".
Comment 1 Chris Rees 2013-05-31 15:52:58 UTC
I think this shouldn't be too hard to automate in the dumpon script,
to be honest.

Please can you try the patch at [1], and set


in /etc/rc.conf, and let me know if it works OK?

Pawel, does this look sane?


[1] http://www.bayofrum.net/~crees/patches/gmirror-dumps.diff
Comment 2 Lawrence Chen 2013-11-06 13:56:05 UTC
Sorry for not replying sooner, but it didn't quite work for me and
forgot to come back later to see why, since what I hacked seemed to be
working...until recently.

So, I revisited this problem.

One change to your diff... http://lkc.me/5D

  Name: Lawrence "The Dreamer" Chen      Email: beastie@tardisi.com
 Snail: 1530 College Ave, A5              Blog: http://lawrencechen.net
        Manhattan, KS 66502-2768         Phone: 785-789-4132
Comment 3 Lawrence Chen 2014-04-29 20:18:52 UTC
On 2013-11-06 07:56, The BSD Dreamer wrote:
> Sorry for not replying sooner, but it didn't quite work for me and
> forgot to come back later to see why, since what I hacked seemed to be
> working...until recently.
> So, I revisited this problem.
> One change to your diff... http://lkc.me/5D

System: FreeBSD zen.lhaven.homeip.net 9.2-RELEASE-p4 FreeBSD 9.2-RELEASE-p4 
#0: Tue Apr  8 18:08:22 UTC 2014     
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

So, recently, I had the system panic twice, where it did dumps but they 
couldn't be found by /etc/rc.d/savecore.

Leads me to suspect that this rc script needs a similar tweak.

Comment 4 Lawrence Chen 2014-06-10 14:08:00 UTC
Discovered the dumpon script wasn't working as expected...turns out its because I have /usr as a separate filesystem and dumpon is called before such things are mounted.  So it can't find 'grep' (/usr/bin/grep), other commands reside in /sbin or /bin....

But, in bug 190152 it sounds like the modification to dumpon is unnecessary.

Since my balance preference is for 'load' (the default) and savecore (at least) 
needs to get switched to 'prefer'...I just hard coded both dumpon and savecore on my system to switch to prefer and then back to load.

Perhaps, an rc.conf variable to specify what balance preference is used (possibly defaulting to 'load' if not set), to avoid trying to grep the output of 'gmirror list <name>'.

'grep' works in savecore, since its called much later...well after FILESYSTEMS (in fact between NETWORKING and SERVERS...closer to SERVERS.)  Guess its fortunate that nothing has touched swap during up to this point, because swapon is done a little after dumpon.
Comment 5 Christian Baltini 2019-06-11 04:29:32 UTC
I have addressed this like so:

This rc.d script fires before savecore and changes the balance to "prefer" and ensures that a specified GEOM provider has a specified priority.


This rc.d script fires after savecore and changes the balance back to whatever is specified in rc.conf (or wherever).


I have tested it working.

In the longer term I think it would be nice if the base system could be smart enough to do something similar.  Until then this appears to do the trick.
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-11 07:29:02 UTC
Can we get an updated patch against FreeBSD head (as of today), as an attachment in this issue, that incorporates any additions/changes/fixes from those referenced in comment 1, comment 2, comment 3 and comment 5 please where appropriate/necessary

If man page changes are required, please provide that as a second patch in this issue as well

^Triage: Issues shouldn't be " in progress" without a real assignee, re-open. Re-classify (product/component)
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-11 07:40:58 UTC
*** Bug 190152 has been marked as a duplicate of this bug. ***
Comment 8 Christian Baltini 2019-06-12 01:26:28 UTC
Created attachment 205001 [details]
gmirror(8) manpage patch

Patch for lib/geom/mirror/gmirror.8 that adds dumpon/savecore scripts for gmirror with modern rc ordering
Comment 9 Christian Baltini 2019-06-12 01:28:34 UTC
See attachment that adds handling scripts for gmirror dumpon/savecore support.
Tentative initial version.
Comment 10 Christos Chatzaras 2019-09-16 07:58:37 UTC
Can someone commit the patches? It would be great to get it in 12.1.
Comment 11 Christian Baltini 2019-10-06 23:10:59 UTC
(In reply to Christos Chatzaras from comment #10)
I would like if somebody could review and give their blessing before any merging, for I am but a scrub. :)
Comment 12 Daniel Ebdrup Jensen freebsd_committer 2021-02-23 08:53:12 UTC
I'd love to get this moving, but gmirror(8) has changed considerably since, and the project has also switched VCS in the meantime, so is it possible that I can get you to supply a git diff for this?

Optionally one that's been run through `git format-patch`, as this preserves a bunch of meta-data like creation time and authorship, so that you get proper credit for your work with the name and email like you want them displayed. :)