Add two more options to raidctl:
-p check (and return) the status of the parity -P check the status of the parity, and rebuild if necessary Addresses PR#7494
This commit is contained in:
parent
a3aefdaee3
commit
d0740fb357
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: raidctl.8,v 1.8 1999/03/24 06:18:30 mycroft Exp $
|
||||
.\" $NetBSD: raidctl.8,v 1.9 1999/08/10 18:21:39 oster Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -86,6 +86,10 @@
|
|||
.Nm ""
|
||||
.Fl I Ar serial_number Ar dev
|
||||
.Nm ""
|
||||
.Fl p Ar dev
|
||||
.Nm ""
|
||||
.Fl P Ar dev
|
||||
.Nm ""
|
||||
.Fl r Ar component Ar dev
|
||||
.Nm ""
|
||||
.Fl R Ar component Ar dev
|
||||
|
@ -162,6 +166,12 @@ is used as one of the keys in determining whether a
|
|||
particular set of components belong to the same RAID set. While not
|
||||
strictly enforced, different serial numbers should be used for
|
||||
different RAID sets.
|
||||
.It Fl p Ar dev
|
||||
Check the status of the parity on the RAID set. Displays a status
|
||||
message, and returns successfully if the parity is up-to-date.
|
||||
.It Fl P Ar dev
|
||||
Check the status of the parity on the RAID set, and initialize
|
||||
(re-write) the parity if the parity is not known to be up-to-date.
|
||||
.It Fl r Ar component Ar dev
|
||||
Remove the spare disk specified by
|
||||
.Ar component
|
||||
|
@ -452,6 +462,24 @@ or
|
|||
on the device or its filesystems, and then to mount the filesystems
|
||||
for use.
|
||||
.Pp
|
||||
After the parity has been initialized for the first time, the command:
|
||||
.Bd -unfilled -offset indent
|
||||
raidctl -p raid0
|
||||
.Ed
|
||||
.Pp
|
||||
can be used to check the current status of the parity. To check the
|
||||
parity and rebuild it necessary the command:
|
||||
.Bd -unfilled -offset indent
|
||||
raidctl -P raid0
|
||||
.Ed
|
||||
.Pp
|
||||
is used. Note that re-writing the parity can be done while
|
||||
other operations on the RAID set are taking place (e.g. while doing a
|
||||
.Xr fsck 8
|
||||
on a filesystem on the RAID set). However: for maximum effectiveness
|
||||
of the RAID set, the parity should be known to be correct before any
|
||||
data on the set is modified.
|
||||
.Pp
|
||||
To see how the RAID set is doing, the following command can be used to
|
||||
show the RAID set's status:
|
||||
.Bd -unfilled -offset indent
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: raidctl.c,v 1.6 1999/03/02 03:13:59 oster Exp $ */
|
||||
/* $NetBSD: raidctl.c,v 1.7 1999/08/10 18:21:39 oster Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -95,6 +95,8 @@ main(argc,argv)
|
|||
char name[PATH_MAX];
|
||||
char component[PATH_MAX];
|
||||
int do_recon;
|
||||
int do_rewrite;
|
||||
int is_clean;
|
||||
int raidID;
|
||||
int rawpart;
|
||||
int recon_percent_done;
|
||||
|
@ -106,9 +108,11 @@ main(argc,argv)
|
|||
num_options = 0;
|
||||
action = 0;
|
||||
do_recon = 0;
|
||||
do_rewrite = 0;
|
||||
is_clean = 0;
|
||||
force = 0;
|
||||
|
||||
while ((ch = getopt(argc, argv, "a:Bc:C:f:F:g:iI:l:r:R:sSu")) != -1)
|
||||
while ((ch = getopt(argc, argv, "a:Bc:C:f:F:g:iI:l:r:R:sSpPu")) != -1)
|
||||
switch(ch) {
|
||||
case 'a':
|
||||
action = RAIDFRAME_ADD_HOT_SPARE;
|
||||
|
@ -180,6 +184,15 @@ main(argc,argv)
|
|||
action = RAIDFRAME_CHECKRECON;
|
||||
num_options++;
|
||||
break;
|
||||
case 'p':
|
||||
action = RAIDFRAME_CHECK_PARITY;
|
||||
num_options++;
|
||||
break;
|
||||
case 'P':
|
||||
action = RAIDFRAME_CHECK_PARITY;
|
||||
do_rewrite = 1;
|
||||
num_options++;
|
||||
break;
|
||||
case 'u':
|
||||
action = RAIDFRAME_SHUTDOWN;
|
||||
num_options++;
|
||||
|
@ -271,6 +284,25 @@ main(argc,argv)
|
|||
case RAIDFRAME_REBUILD_IN_PLACE:
|
||||
rebuild_in_place(fd,component);
|
||||
break;
|
||||
case RAIDFRAME_CHECK_PARITY:
|
||||
do_ioctl(fd, RAIDFRAME_CHECK_PARITY, &is_clean,
|
||||
"RAIDFRAME_CHECK_PARITY");
|
||||
if (is_clean) {
|
||||
printf("%s: Parity status: clean\n",dev_name);
|
||||
} else {
|
||||
printf("%s: Parity status: DIRTY\n",dev_name);
|
||||
if (do_rewrite) {
|
||||
printf("%s: Initiating re-write of parity\n",
|
||||
dev_name);
|
||||
do_ioctl(fd, RAIDFRAME_REWRITEPARITY, NULL,
|
||||
"RAIDFRAME_REWRITEPARITY");
|
||||
} else {
|
||||
/* parity is wrong, and is not being fixed.
|
||||
Exit w/ an error. */
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RAIDFRAME_SHUTDOWN:
|
||||
do_ioctl(fd, RAIDFRAME_SHUTDOWN, NULL, "RAIDFRAME_SHUTDOWN");
|
||||
break;
|
||||
|
@ -585,7 +617,6 @@ rebuild_in_place( fd, component )
|
|||
"RAIDFRAME_REBUILD_IN_PLACE");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue