|
Lines 24-30
Link Here
|
| 24 |
.\" |
24 |
.\" |
| 25 |
.\" $FreeBSD$ |
25 |
.\" $FreeBSD$ |
| 26 |
.\" |
26 |
.\" |
| 27 |
.Dd November 30, 2017 |
27 |
.Dd June 11, 2019 |
| 28 |
.Dt GMIRROR 8 |
28 |
.Dt GMIRROR 8 |
| 29 |
.Os |
29 |
.Os |
| 30 |
.Sh NAME |
30 |
.Sh NAME |
|
Lines 380-418
Link Here
|
| 380 |
Doing kernel dumps to |
380 |
Doing kernel dumps to |
| 381 |
.Nm |
381 |
.Nm |
| 382 |
providers is possible, but some conditions have to be met. |
382 |
providers is possible, but some conditions have to be met. |
| 383 |
First of all, a kernel dump will go only to one component and |
383 |
First of all, when |
|
|
384 |
.Xr dumpon 8 |
| 385 |
is called |
| 386 |
.Nm |
| 387 |
always chooses the provider with the highest priority. That provider |
| 388 |
will be the only |
| 389 |
.Nm |
| 390 |
member with the kernel dump present. |
| 391 |
|
| 392 |
Retrieving the dump on next boot is therefore conditional on two factors: |
| 393 |
|
| 394 |
.Bl -bullet -offset indent -compact |
| 395 |
.It |
| 396 |
The |
| 384 |
.Nm |
397 |
.Nm |
| 385 |
always chooses the component with the highest priority. |
398 |
balance algorithm must be |
| 386 |
Reading a dump from the mirror on boot will only work if the |
|
|
| 387 |
.Cm prefer |
399 |
.Cm prefer |
| 388 |
balance algorithm is used (that way |
400 |
.It |
|
|
401 |
The |
| 389 |
.Nm |
402 |
.Nm |
| 390 |
will read only from the component with the highest priority). |
403 |
provider with the highest priority must remain consistent between when |
| 391 |
If you use a different balance algorithm, you should add: |
404 |
.Xr dumpon 8 |
|
|
405 |
and |
| 406 |
.Xr savecore 8 |
| 407 |
are called (on panic, and upon next boot, respectively). |
| 408 |
.El |
| 409 |
|
| 410 |
If either of the above points are not ensured, when |
| 411 |
.Xr savecore 8 |
| 412 |
is called |
| 413 |
.Nm |
| 414 |
is liable to return from the provider without the kernel dump present, |
| 415 |
and |
| 416 |
.Xr savecore 8 will not be able to process the dump. |
| 417 |
|
| 418 |
Placing the below script in |
| 419 |
.Pa /usr/local/etc/rc.d |
| 420 |
will ensure that the |
| 421 |
.Nm |
| 422 |
balance algorithm is set to |
| 423 |
.Cm prefer |
| 424 |
and that a provider has a set priority when |
| 425 |
.Xr savecore 8 |
| 426 |
is called. |
| 392 |
.Bd -literal -offset indent |
427 |
.Bd -literal -offset indent |
| 393 |
gmirror configure -b prefer data |
428 |
#!/bin/sh |
|
|
429 |
|
| 430 |
# PROVIDE: gmirror_prefer_algo |
| 431 |
# REQUIRE: disks |
| 432 |
# BEFORE: savecore gmirror_balance_algo |
| 433 |
# KEYWORD: nojail |
| 434 |
|
| 435 |
\&. etc/rc.subr |
| 436 |
|
| 437 |
name=gmirror_prefer_algo |
| 438 |
desc="Sets gmirror balance algorithm to prefer and sets a provider priority" |
| 439 |
rcvar=gmirror_prefer_algo_enable |
| 440 |
|
| 441 |
start_cmd="${name}_start" |
| 442 |
stop_cmd=":" |
| 443 |
load_rc_config $name |
| 444 |
: ${gmirror_prefer_algo_enable="NO"} |
| 445 |
: ${gmirror_prefer_algo_mirror=""} |
| 446 |
: ${gmirror_prefer_algo_provider=""} |
| 447 |
: ${gmirror_prefer_algo_priority=1} |
| 448 |
|
| 449 |
gmirror_prefer_start() |
| 450 |
{ |
| 451 |
balance_cmd="gmirror configure -b prefer ${gmirror_prefer_algo_mirror}" |
| 452 |
priority_cmd="gmirror configure -p ${gmirror_prefer_algo_priority} ${gmirror_prefer_algo_mirror} ${gmirror_prefer_algo_provider}" |
| 453 |
$balance_cmd |
| 454 |
$priority_cmd |
| 455 |
} |
| 456 |
|
| 457 |
run_rc_command "$1" |
| 394 |
.Ed |
458 |
.Ed |
| 395 |
.Pp |
459 |
|
| 396 |
to the |
460 |
Add the below lines to /usr/local/etc/rc.conf to enable the script and specify |
| 397 |
.Pa /etc/rc.early |
461 |
.Nm |
| 398 |
script and: |
462 |
configuration: |
| 399 |
.Bd -literal -offset indent |
463 |
.Bd -literal -offset indent |
| 400 |
gmirror configure -b round-robin data |
464 |
gmirror_prefer_algo_enable="YES" |
|
|
465 |
gmirror_prefer_algo_mirror="yourmirrorname" # Specify the name of the gmirror to configure. |
| 466 |
gmirror_prefer_algo_provider="yourprovidername" # Specify the name of the provider to configure. |
| 467 |
gmirror_prefer_algo_priority=N # Specify the priority of the provider to configure, where N is a valid priority integer. |
| 401 |
.Ed |
468 |
.Ed |
| 402 |
.Pp |
469 |
|
| 403 |
to the |
470 |
.Sy Note: |
| 404 |
.Pa /etc/rc.local |
471 |
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. |
| 405 |
script. |
472 |
|
| 406 |
The decision which component to choose for dumping is made when |
473 |
If a |
| 407 |
.Xr dumpon 8 |
474 |
algorithm other than |
| 408 |
is called. |
475 |
.Cm prefer |
| 409 |
If on the next boot a component with a higher priority will be available, |
476 |
is desired for normal |
| 410 |
the prefer algorithm will choose to read from it and |
477 |
.Nm |
|
|
478 |
operation, placing the below script in |
| 479 |
.Pa /usr/local/etc/rc.d |
| 480 |
will ensure that the |
| 481 |
.Nm |
| 482 |
balance algorithm is re-configured after |
| 411 |
.Xr savecore 8 |
483 |
.Xr savecore 8 |
| 412 |
will find nothing. |
484 |
is called. |
| 413 |
If on the next boot a component with the highest priority will be synchronized, |
485 |
|
| 414 |
the prefer balance algorithm will read from the next one, thus will find nothing |
486 |
.Bd -literal -offset indent |
| 415 |
there. |
487 |
#!/bin/sh |
|
|
488 |
|
| 489 |
# PROVIDE: gmirror_balance_algo |
| 490 |
# REQUIRE: savecore gmirror_prefer_algo |
| 491 |
# BEFORE: |
| 492 |
# KEYWORD: nojail |
| 493 |
|
| 494 |
\&. etc/rc.subr |
| 495 |
|
| 496 |
name=gmirror_balance_algo |
| 497 |
desc="Sets gmirror balance algorithm" |
| 498 |
rcvar=gmirror_prefer_algo_enable |
| 499 |
|
| 500 |
start_cmd="${name}_start" |
| 501 |
stop_cmd=":" |
| 502 |
load_rc_config $name |
| 503 |
: ${gmirror_prefer_algo_enable="NO"} |
| 504 |
: ${gmirror_prefer_algo_mirror=""} |
| 505 |
: ${gmirror_balance_algo="load"} |
| 506 |
|
| 507 |
gmirror_balance_algo_start() |
| 508 |
{ |
| 509 |
balance_cmd="gmirror configure -b ${gmirror_balance_algo} ${gmirror_prefer_mirror}" |
| 510 |
$balance_cmd |
| 511 |
} |
| 512 |
|
| 513 |
run_rc_command "$1" |
| 514 |
.Ed |
| 515 |
|
| 516 |
Add the below lines to /usr/local/etc/rc.conf to enable the script and specify |
| 517 |
.Nm |
| 518 |
configuration: |
| 519 |
.Bd -literal -offset indent |
| 520 |
gmirror_balance_algo="algo" # Specify the balance algorithm to be used for normal gmirror operation, where "algo" is a valid |
| 521 |
balance algorithm. |
| 522 |
.Ed |
| 416 |
.Sh SEE ALSO |
523 |
.Sh SEE ALSO |
| 417 |
.Xr geom 4 , |
524 |
.Xr geom 4 , |
| 418 |
.Xr dumpon 8 , |
525 |
.Xr dumpon 8 , |