mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Add "addspare" functionality.
This commit is contained in:
parent
31de970e72
commit
0a124c3704
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114530
@ -52,6 +52,9 @@
|
||||
.Ic delete
|
||||
.Ar raid
|
||||
.Nm
|
||||
.Ic addspare
|
||||
.Ar raid disk
|
||||
.Nm
|
||||
.Ic rebuild
|
||||
.Ar raid
|
||||
.Nm
|
||||
@ -152,6 +155,8 @@ the partition to boot must
|
||||
reside on the first disk in the SPAN.
|
||||
.It Ic delete
|
||||
Delete a RAID array on a RAID capable ATA controller.
|
||||
.It Ic addspare
|
||||
Add a spare disk to an existing RAID.
|
||||
.It Ic rebuild
|
||||
Rebuild a RAID1 array on a RAID capable ATA controller.
|
||||
.It Ic status
|
||||
|
@ -263,9 +263,10 @@ main(int argc, char **argv)
|
||||
if (argc > 2 && strcmp(argv[1], "create")) {
|
||||
int chan;
|
||||
|
||||
if (!strcmp(argv[1], "delete") ||
|
||||
!strcmp(argv[1], "status") ||
|
||||
!strcmp(argv[1], "rebuild")) {
|
||||
if (!strcmp(argv[1], "addspare") ||
|
||||
!strcmp(argv[1], "delete") ||
|
||||
!strcmp(argv[1], "rebuild") ||
|
||||
!strcmp(argv[1], "status")) {
|
||||
if (!(sscanf(argv[2], "%d", &chan) == 1 ||
|
||||
sscanf(argv[2], "ar%d", &chan) == 1))
|
||||
usage();
|
||||
@ -361,6 +362,17 @@ main(int argc, char **argv)
|
||||
if (ioctl(fd, IOCATA, &iocmd) < 0)
|
||||
warn("ioctl(ATARAIDDELETE)");
|
||||
}
|
||||
else if (!strcmp(argv[1], "addspare") && argc == 4) {
|
||||
int dev;
|
||||
|
||||
iocmd.cmd = ATARAIDADDSPARE;
|
||||
if (!(sscanf(argv[3], "%d", &dev) == 1 ||
|
||||
sscanf(argv[3], "ad%d", &dev) == 1))
|
||||
usage();
|
||||
iocmd.u.raid_spare.disk = dev;
|
||||
if (ioctl(fd, IOCATA, &iocmd) < 0)
|
||||
warn("ioctl(ATARAIDADDSPARE)");
|
||||
}
|
||||
else if (!strcmp(argv[1], "rebuild") && argc == 3) {
|
||||
iocmd.cmd = ATARAIDREBUILD;
|
||||
if (ioctl(fd, IOCATA, &iocmd) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user