diff options
author | sos <sos@FreeBSD.org> | 2003-05-02 12:42:31 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2003-05-02 12:42:31 +0000 |
commit | 282348e1faecb4f9519c2668a0f1d8fdd7cbd7e5 (patch) | |
tree | b6ad769fbf678f46fc312ac16faf65aa3434ec85 /sbin/atacontrol | |
parent | 66a49a9d90fddf3a454394837073218ec971ac4b (diff) | |
download | FreeBSD-src-282348e1faecb4f9519c2668a0f1d8fdd7cbd7e5.zip FreeBSD-src-282348e1faecb4f9519c2668a0f1d8fdd7cbd7e5.tar.gz |
Add "addspare" functionality.
Diffstat (limited to 'sbin/atacontrol')
-rw-r--r-- | sbin/atacontrol/atacontrol.8 | 5 | ||||
-rw-r--r-- | sbin/atacontrol/atacontrol.c | 18 |
2 files changed, 20 insertions, 3 deletions
diff --git a/sbin/atacontrol/atacontrol.8 b/sbin/atacontrol/atacontrol.8 index 9efb2de..2f69457 100644 --- a/sbin/atacontrol/atacontrol.8 +++ b/sbin/atacontrol/atacontrol.8 @@ -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 diff --git a/sbin/atacontrol/atacontrol.c b/sbin/atacontrol/atacontrol.c index d453d2a..ea7f4cb 100644 --- a/sbin/atacontrol/atacontrol.c +++ b/sbin/atacontrol/atacontrol.c @@ -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) |