--- gmirror.8 2019-06-11 15:09:02.000000000 -0700 +++ gmirror.8.update 2019-06-11 18:24:00.000000000 -0700 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2017 +.Dd June 11, 2019 .Dt GMIRROR 8 .Os .Sh NAME @@ -380,39 +380,146 @@ Doing kernel dumps to .Nm providers is possible, but some conditions have to be met. -First of all, a kernel dump will go only to one component and +First of all, when +.Xr dumpon 8 +is called +.Nm +always chooses the provider with the highest priority. That provider +will be the only +.Nm +member with the kernel dump present. + +Retrieving the dump on next boot is therefore conditional on two factors: + +.Bl -bullet -offset indent -compact +.It +The .Nm -always chooses the component with the highest priority. -Reading a dump from the mirror on boot will only work if the +balance algorithm must be .Cm prefer -balance algorithm is used (that way +.It +The .Nm -will read only from the component with the highest priority). -If you use a different balance algorithm, you should add: +provider with the highest priority must remain consistent between when +.Xr dumpon 8 +and +.Xr savecore 8 +are called (on panic, and upon next boot, respectively). +.El + +If either of the above points are not ensured, when +.Xr savecore 8 +is called +.Nm +is liable to return from the provider without the kernel dump present, +and +.Xr savecore 8 will not be able to process the dump. + +Placing the below script in +.Pa /usr/local/etc/rc.d +will ensure that the +.Nm +balance algorithm is set to +.Cm prefer +and that a provider has a set priority when +.Xr savecore 8 +is called. .Bd -literal -offset indent -gmirror configure -b prefer data +#!/bin/sh + +# PROVIDE: gmirror_prefer_algo +# REQUIRE: disks +# BEFORE: savecore gmirror_balance_algo +# KEYWORD: nojail + +\&. etc/rc.subr + +name=gmirror_prefer_algo +desc="Sets gmirror balance algorithm to prefer and sets a provider priority" +rcvar=gmirror_prefer_algo_enable + +start_cmd="${name}_start" +stop_cmd=":" +load_rc_config $name +: ${gmirror_prefer_algo_enable="NO"} +: ${gmirror_prefer_algo_mirror=""} +: ${gmirror_prefer_algo_provider=""} +: ${gmirror_prefer_algo_priority=1} + +gmirror_prefer_start() +{ + balance_cmd="gmirror configure -b prefer ${gmirror_prefer_algo_mirror}" + priority_cmd="gmirror configure -p ${gmirror_prefer_algo_priority} ${gmirror_prefer_algo_mirror} ${gmirror_prefer_algo_provider}" + $balance_cmd + $priority_cmd +} + +run_rc_command "$1" .Ed -.Pp -to the -.Pa /etc/rc.early -script and: + +Add the below lines to /usr/local/etc/rc.conf to enable the script and specify +.Nm +configuration: .Bd -literal -offset indent -gmirror configure -b round-robin data +gmirror_prefer_algo_enable="YES" +gmirror_prefer_algo_mirror="yourmirrorname" # Specify the name of the gmirror to configure. +gmirror_prefer_algo_provider="yourprovidername" # Specify the name of the provider to configure. +gmirror_prefer_algo_priority=N # Specify the priority of the provider to configure, where N is a valid priority integer. .Ed -.Pp -to the -.Pa /etc/rc.local -script. -The decision which component to choose for dumping is made when -.Xr dumpon 8 -is called. -If on the next boot a component with a higher priority will be available, -the prefer algorithm will choose to read from it and + +.Sy Note: +It is adviseable to create your gmirror with "-h" and add providers via GPT or GEOM labels so as to ensure the provider name will be consistent. + +If a +algorithm other than +.Cm prefer +is desired for normal +.Nm +operation, placing the below script in +.Pa /usr/local/etc/rc.d +will ensure that the +.Nm +balance algorithm is re-configured after .Xr savecore 8 -will find nothing. -If on the next boot a component with the highest priority will be synchronized, -the prefer balance algorithm will read from the next one, thus will find nothing -there. +is called. + +.Bd -literal -offset indent +#!/bin/sh + +# PROVIDE: gmirror_balance_algo +# REQUIRE: savecore gmirror_prefer_algo +# BEFORE: +# KEYWORD: nojail + +\&. etc/rc.subr + +name=gmirror_balance_algo +desc="Sets gmirror balance algorithm" +rcvar=gmirror_prefer_algo_enable + +start_cmd="${name}_start" +stop_cmd=":" +load_rc_config $name +: ${gmirror_prefer_algo_enable="NO"} +: ${gmirror_prefer_algo_mirror=""} +: ${gmirror_balance_algo="load"} + +gmirror_balance_algo_start() +{ + balance_cmd="gmirror configure -b ${gmirror_balance_algo} ${gmirror_prefer_mirror}" + $balance_cmd +} + +run_rc_command "$1" +.Ed + +Add the below lines to /usr/local/etc/rc.conf to enable the script and specify +.Nm +configuration: +.Bd -literal -offset indent +gmirror_balance_algo="algo" # Specify the balance algorithm to be used for normal gmirror operation, where "algo" is a valid +balance algorithm. +.Ed .Sh SEE ALSO .Xr geom 4 , .Xr dumpon 8 ,