2 * mdadm - manage Linux "md" devices aka RAID arrays.
4 * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Email: <neilb@cse.unsw.edu.au>
24 * School of Computer Science and Engineering
25 * The University of New South Wales
29 * Additions for bitmap and async RAID options, Copyright (C) 2003-2004,
30 * Paul Clements, SteelEye Technology, Inc.
38 int main(int argc
, char *argv
[])
54 struct mddev_ident_s ident
;
55 char *configfile
= NULL
;
63 char *bitmap_file
= NULL
;
64 int bitmap_chunk
= UnSet
;
66 mddev_dev_t devlist
= NULL
;
67 mddev_dev_t
*devlistend
= & devlist
;
75 int autof
= 0; /* -2 means create device based on name:
76 * if it ends mdN, then non-partitioned array N
77 * if it ends dN, then partitions array N
78 * -1 means create non-partitioned, choose N
79 * 1 or more to create partitioned
80 * If -1 or 1 and name is a 'standard' name, then
81 * insist on a match of type and number.
84 char *mailaddr
= NULL
;
90 struct supertype
*ss
= NULL
;
98 ident
.raid_disks
= UnSet
;
99 ident
.super_minor
= UnSet
;
101 ident
.spare_group
= NULL
;
104 ident
.bitmap_fd
= -1;
106 while ((option_index
= -1) ,
107 (opt
=getopt_long(argc
, argv
,
108 short_options
, long_options
,
109 &option_index
)) != -1) {
111 /* firstly, so mode-independant options */
115 if (option_index
> 0 &&
116 strcmp(long_options
[option_index
].name
, "help-options")==0)
117 help_text
= OptionHelp
;
120 case ASSEMBLE
: help_text
= Help_assemble
; break;
121 case BUILD
: help_text
= Help_build
; break;
122 case CREATE
: help_text
= Help_create
; break;
123 case MANAGE
: help_text
= Help_manage
; break;
124 case MISC
: help_text
= Help_misc
; break;
125 case MONITOR
: help_text
= Help_monitor
; break;
126 case GROW
: help_text
= Help_grow
; break;
128 fputs(help_text
,stderr
);
132 fputs(Version
, stderr
);
135 case 'v': verbose
= 1;
139 if (mode
== ASSEMBLE
|| mode
== BUILD
|| mode
== CREATE
)
140 break; /* b means bitmap */
146 fputs(Usage
, stderr
);
149 /* second, figure out the mode.
150 * Some options force the mode. Others
151 * set the mode if it isn't already
155 case '@': /* just incase they say --manage */
156 newmode
= MANAGE
; break;
160 if (!mode
) newmode
= MANAGE
;
163 case 'A': newmode
= ASSEMBLE
; break;
164 case 'B': newmode
= BUILD
; break;
165 case 'C': newmode
= CREATE
; break;
166 case 'F': newmode
= MONITOR
;break;
167 case 'G': newmode
= GROW
; break;
173 case 'Q': newmode
= MISC
; break;
178 case 'K': if (!mode
) newmode
= MISC
; break;
180 if (mode
&& newmode
== mode
) {
181 /* everybody happy ! */
182 } else if (mode
&& newmode
!= mode
) {
184 fprintf(stderr
, Name
": ");
185 if (option_index
>= 0)
186 fprintf(stderr
, "--%s", long_options
[option_index
].name
);
188 fprintf(stderr
, "-%c", opt
);
189 fprintf(stderr
, " would set mdadm mode to \"%s\", but it is already set to \"%s\".\n",
190 map_num(modes
, newmode
),
191 map_num(modes
, mode
));
193 } else if (!mode
&& newmode
) {
196 /* special case of -c --help */
198 ( strncmp(optarg
, "--h", 3)==0 ||
199 strncmp(optarg
, "-h", 2)==0)) {
200 fputs(Help_config
, stderr
);
204 /* If first option is a device, don't force the mode yet */
206 if (devs_found
== 0) {
207 dv
= malloc(sizeof(*dv
));
209 fprintf(stderr
, Name
": malloc failed\n");
212 dv
->devname
= optarg
;
213 dv
->disposition
= devmode
;
216 devlistend
= &dv
->next
;
221 /* No mode yet, and this is the second device ... */
222 fprintf(stderr
, Name
": An option must be given to set the mode before a second device is listed\n");
225 if (option_index
>= 0)
226 fprintf(stderr
, Name
": --%s", long_options
[option_index
].name
);
228 fprintf(stderr
, Name
": -%c", opt
);
229 fprintf(stderr
, " does not set the mode, and so cannot be the first option.\n");
233 /* if we just set the mode, then done */
245 /* an undecorated option - must be a device name.
247 if (devs_found
> 0 && mode
== '@' && !devmode
) {
248 fprintf(stderr
, Name
": Must give one of -a/-r/-f for subsequent devices at %s\n", optarg
);
251 if (devs_found
> 0 && mode
== 'G' && !devmode
) {
252 fprintf(stderr
, Name
": Must give one of -a for devices do add: %s\n", optarg
);
255 dv
= malloc(sizeof(*dv
));
257 fprintf(stderr
, Name
": malloc failed\n");
260 dv
->devname
= optarg
;
261 dv
->disposition
= devmode
;
264 devlistend
= &dv
->next
;
270 /* We've got a mode, and opt is now something else which
271 * could depend on the mode */
272 #define O(a,b) ((a<<8)|b)
273 switch (O(mode
,opt
)) {
275 case O(BUILD
,'c'): /* chunk or rounding */
277 fprintf(stderr
, Name
": chunk/rounding may only be specified once. "
278 "Second value is %s.\n", optarg
);
281 chunk
= strtol(optarg
, &c
, 10);
282 if (!optarg
[0] || *c
|| chunk
<4 || ((chunk
-1)&chunk
)) {
283 fprintf(stderr
, Name
": invalid chunk/rounding value: %s\n",
290 case O(ASSEMBLE
,'e'):
291 case O(MISC
,'e'): /* set metadata (superblock) information */
293 fprintf(stderr
, Name
": metadata information already given\n");
296 for(i
=0; !ss
&& superlist
[i
]; i
++)
297 ss
= superlist
[i
]->match_metadata_desc(optarg
);
300 fprintf(stderr
, Name
": unrecognised metadata identifier: %s\n", optarg
);
306 case O(CREATE
,'z'): /* size */
308 fprintf(stderr
, Name
": size may only be specified once. "
309 "Second value is %s.\n", optarg
);
312 if (strcmp(optarg
, "max")==0)
315 size
= strtol(optarg
, &c
, 10);
316 if (!optarg
[0] || *c
|| size
< 4) {
317 fprintf(stderr
, Name
": invalid size: %s\n",
324 case O(GROW
,'l'): /* hack - needed to understand layout */
326 case O(BUILD
,'l'): /* set raid level*/
327 if (level
!= UnSet
) {
328 fprintf(stderr
, Name
": raid level may only be set once. "
329 "Second value is %s.\n", optarg
);
332 level
= map_name(pers
, optarg
);
333 if (level
== UnSet
) {
334 fprintf(stderr
, Name
": invalid raid level: %s\n",
338 if (level
!= 0 && level
!= -1 && level
!= 1 && level
!= -4 && level
!= -5 && mode
== BUILD
) {
339 fprintf(stderr
, Name
": Raid level %s not permitted with --build.\n",
343 if (sparedisks
> 0 && level
< 1 && level
>= -1) {
344 fprintf(stderr
, Name
": raid level %s is incompatible with spare-devices setting.\n",
351 case O(CREATE
,'p'): /* raid5 layout */
352 case O(BUILD
,'p'): /* faulty layout */
353 case O(GROW
, 'p'): /* faulty reconfig */
354 if (layout
!= UnSet
) {
355 fprintf(stderr
,Name
": layout may only be sent once. "
356 "Second value was %s\n", optarg
);
361 fprintf(stderr
, Name
": layout not meaningful for %s arrays.\n",
362 map_num(pers
, level
));
365 fprintf(stderr
, Name
": raid level must be given before layout.\n");
370 layout
= map_name(r5layout
, optarg
);
372 fprintf(stderr
, Name
": layout %s not understood for raid5.\n",
379 /* 'f' or 'n' followed by a number <= raid_disks */
380 if ((optarg
[0] != 'n' && optarg
[0] != 'f') ||
381 (copies
= strtoul(optarg
+1, &cp
, 10)) < 1 ||
384 fprintf(stderr
, Name
": layout for raid10 must be 'nNN' or 'fNN' where NN is a number, not %s\n", optarg
);
387 if (optarg
[0] == 'n')
388 layout
= 256 + copies
;
390 layout
= 1 + (copies
<<8);
397 int ln
= strcspn(optarg
, "0123456789");
398 char *m
= strdup(optarg
);
401 mode
= map_name(faultylayout
, m
);
403 fprintf(stderr
, Name
": layout %s not understood for faulty.\n",
407 layout
= mode
| (atoi(optarg
+ln
)<< ModeShift
);
413 case O(BUILD
,3): /* assume clean */
419 case O(BUILD
,'n'): /* number of raid disks */
421 fprintf(stderr
, Name
": raid-devices set twice: %d and %s\n",
425 raiddisks
= strtol(optarg
, &c
, 10);
426 if (!optarg
[0] || *c
|| raiddisks
<=0 || raiddisks
> MD_SB_DISKS
) {
427 fprintf(stderr
, Name
": invalid number of raid devices: %s\n",
431 if (raiddisks
== 1 && !force
&& level
!= -5) {
432 fprintf(stderr
, Name
": '1' is an unusual number of drives for an array, so it is probably\n"
433 " a mistake. If you really mean it you will need to specify --force before\n"
434 " setting the number of drives.\n");
437 ident
.raid_disks
= raiddisks
;
440 case O(CREATE
,'x'): /* number of spare (eXtra) discs */
442 fprintf(stderr
,Name
": spare-devices set twice: %d and %s\n",
446 if (level
!= UnSet
&& level
<= 0 && level
>= -1) {
447 fprintf(stderr
, Name
": spare-devices setting is incompatible with raid level %d\n",
451 sparedisks
= strtol(optarg
, &c
, 10);
452 if (!optarg
[0] || *c
|| sparedisks
< 0 || sparedisks
> MD_SB_DISKS
- raiddisks
) {
453 fprintf(stderr
, Name
": invalid number of spare-devices: %s\n",
461 case O(ASSEMBLE
,'a'): /* auto-creation of device node */
464 else if (strcasecmp(optarg
,"no")==0)
466 else if (strcasecmp(optarg
,"yes")==0)
468 else if (strcasecmp(optarg
,"md")==0)
471 /* There might be digits, and maybe a hypen, at the end */
472 char *e
= optarg
+ strlen(optarg
);
475 while (e
> optarg
&& isdigit(e
[-1]))
479 if (num
<= 0) num
= 1;
481 if (e
> optarg
&& e
[-1] == '-')
484 if ((len
== 3 && strncasecmp(optarg
,"mdp",3)==0) ||
485 (len
== 1 && strncasecmp(optarg
,"p",1)==0) ||
486 (len
>= 4 && strncasecmp(optarg
,"part",4)==0))
489 fprintf(stderr
, Name
": --auto flag arg of \"%s\" unrecognised: use no,yes,md,mdp,part\n"
490 " optionally followed by a number.\n",
497 case O(BUILD
,'f'): /* force honouring '-n 1' */
498 case O(CREATE
,'f'): /* force honouring of device list */
499 case O(ASSEMBLE
,'f'): /* force assembly */
500 case O(MISC
,'f'): /* force zero */
504 /* now for the Assemble options */
505 case O(ASSEMBLE
,'u'): /* uuid of array */
506 if (ident
.uuid_set
) {
507 fprintf(stderr
, Name
": uuid cannot be set twice. "
508 "Second value %s.\n", optarg
);
511 if (parse_uuid(optarg
, ident
.uuid
))
514 fprintf(stderr
,Name
": Bad uuid: %s\n", optarg
);
519 case O(ASSEMBLE
,'m'): /* super-minor for array */
520 if (ident
.super_minor
!= UnSet
) {
521 fprintf(stderr
, Name
": super-minor cannot be set twice. "
522 "Second value: %s.\n", optarg
);
525 if (strcmp(optarg
, "dev")==0)
526 ident
.super_minor
= -2;
528 ident
.super_minor
= strtoul(optarg
, &cp
, 10);
529 if (!optarg
[0] || *cp
) {
530 fprintf(stderr
, Name
": Bad super-minor number: %s.\n", optarg
);
536 case O(ASSEMBLE
,'U'): /* update the superblock */
538 fprintf(stderr
, Name
": Can only update one aspect of superblock, both %s and %s given.\n",
543 if (strcmp(update
, "sparc2.2")==0)
545 if (strcmp(update
, "super-minor") == 0)
547 if (strcmp(update
, "summaries")==0)
549 if (strcmp(update
, "resync")==0)
551 fprintf(stderr
, Name
": '--update %s' invalid. Only 'sparc2.2', 'super-minor', 'resync' or 'summaries' supported\n",update
);
554 case O(ASSEMBLE
,'c'): /* config file */
558 fprintf(stderr
, Name
": configfile cannot be set twice. "
559 "Second value is %s.\n", optarg
);
563 /* FIXME possibly check that config file exists. Even parse it */
565 case O(ASSEMBLE
,'s'): /* scan */
571 case O(MONITOR
,'m'): /* mail address */
573 fprintf(stderr
, Name
": only specify one mailaddress. %s ignored.\n",
579 case O(MONITOR
,'p'): /* alert program */
581 fprintf(stderr
, Name
": only specify one alter program. %s ignored.\n",
587 case O(MONITOR
,'d'): /* delay in seconds */
588 case O(BUILD
,'d'): /* delay for bitmap updates */
591 fprintf(stderr
, Name
": only specify delay once. %s ignored.\n",
594 delay
= strtol(optarg
, &c
, 10);
595 if (!optarg
[0] || *c
|| delay
<1) {
596 fprintf(stderr
, Name
": invalid delay: %s\n",
602 case O(MONITOR
,'f'): /* daemonise */
605 case O(MONITOR
,'i'): /* pid */
607 fprintf(stderr
, Name
": only specify one pid file. %s ignored.\n",
612 case O(MONITOR
,'1'): /* oneshot */
615 case O(MONITOR
,'t'): /* test */
619 /* now the general management options. Some are applicable
620 * to other modes. None have arguments.
623 case O(MANAGE
,'a'): /* add a drive */
626 case O(MANAGE
,'r'): /* remove a drive */
629 case O(MANAGE
,'f'): /* set faulty */
633 case O(ASSEMBLE
,'R'):
635 case O(CREATE
,'R'): /* Run the array */
637 fprintf(stderr
, Name
": Cannot both Stop and Run an array\n");
644 fprintf(stderr
, Name
": Cannot both Run and Stop an array\n");
652 fprintf(stderr
, Name
": Cannot have both readonly and readwrite\n");
659 fprintf(stderr
, Name
": Cannot have both readwrite and readonly.\n");
674 if (devmode
&& devmode
!= opt
&&
675 (devmode
== 'E' || (opt
== 'E' && devmode
!= 'Q'))) {
676 fprintf(stderr
, Name
": --examine/-E cannot be given with -%c\n",
677 devmode
=='E'?opt
:devmode
);
687 if (devmode
!= 'E') {
688 fprintf(stderr
, Name
": --sparc2.2 only allowed with --examine\n");
694 case O(ASSEMBLE
,'b'): /* here we simply set the bitmap file */
696 fprintf(stderr
, Name
": bitmap file needed with -b in --assemble mode\n");
699 bitmap_fd
= open(optarg
, O_RDWR
);
700 if (!*optarg
|| bitmap_fd
< 0) {
701 fprintf(stderr
, Name
": cannot open bitmap file %s: %s\n", optarg
, strerror(errno
));
704 ident
.bitmap_fd
= bitmap_fd
; /* for Assemble */
707 case O(CREATE
,'b'): /* here we create the bitmap */
708 bitmap_file
= optarg
;
712 case O(CREATE
,4): /* bitmap chunksize */
713 bitmap_chunk
= strtol(optarg
, &c
, 10);
714 if (!optarg
[0] || *c
|| bitmap_chunk
< 0 ||
715 bitmap_chunk
& (bitmap_chunk
- 1)) {
716 fprintf(stderr
, Name
": invalid bitmap chunksize: %s\n",
720 /* convert K to B, chunk of 0K means 512B */
721 bitmap_chunk
= bitmap_chunk
? bitmap_chunk
* 1024 : 512;
724 /* We have now processed all the valid options. Anything else is
727 fprintf(stderr
, Name
": option %c not valid in %s mode\n",
728 opt
, map_num(modes
, mode
));
733 if (!mode
&& devs_found
) {
736 if (devlist
->disposition
== 0)
737 devlist
->disposition
= devmode
;
740 fputs(Usage
, stderr
);
743 /* Ok, got the option parsing out of the way
744 * hopefully it's mostly right but there might be some stuff
747 * That is mosty checked in the per-mode stuff but...
749 * For @,B,C and A without -s, the first device listed must be an md device
750 * we check that here and open it.
753 if (mode
==MANAGE
|| mode
== BUILD
|| mode
== CREATE
|| mode
== GROW
||
754 (mode
== ASSEMBLE
&& ! scan
)) {
755 if (devs_found
< 1) {
756 fprintf(stderr
, Name
": an md device must be given in this mode\n");
759 if ((int)ident
.super_minor
== -2 && autof
) {
760 fprintf(stderr
, Name
": --super-minor=dev is incompatible with --auto\n");
763 mdfd
= open_mddev(devlist
->devname
, autof
);
766 if ((int)ident
.super_minor
== -2) {
769 ident
.super_minor
= minor(stb
.st_rdev
);
777 /* readonly, add/remove, readwrite, runstop */
779 rv
= Manage_ro(devlist
->devname
, mdfd
, readonly
);
780 if (!rv
&& devs_found
>1)
781 rv
= Manage_subdevs(devlist
->devname
, mdfd
,
783 if (!rv
&& readonly
< 0)
784 rv
= Manage_ro(devlist
->devname
, mdfd
, readonly
);
786 rv
= Manage_runstop(devlist
->devname
, mdfd
, runstop
);
789 if (devs_found
== 1 && ident
.uuid_set
== 0 &&
790 ident
.super_minor
== UnSet
&& !scan
) {
791 /* Only a device has been given, so get details from config file */
792 mddev_ident_t array_ident
= conf_get_ident(configfile
, devlist
->devname
);
793 if (array_ident
== NULL
) {
794 fprintf(stderr
, Name
": %s not identified in config file.\n",
798 mdfd
= open_mddev(devlist
->devname
, array_ident
->autof
);
802 rv
|= Assemble(ss
, devlist
->devname
, mdfd
, array_ident
, configfile
,
804 readonly
, runstop
, update
, verbose
, force
);
809 rv
= Assemble(ss
, devlist
->devname
, mdfd
, &ident
, configfile
,
811 readonly
, runstop
, update
, verbose
, force
);
812 else if (devs_found
>0) {
813 if (update
&& devs_found
> 1) {
814 fprintf(stderr
, Name
": can only update a single array at a time\n");
817 for (dv
= devlist
; dv
; dv
=dv
->next
) {
818 mddev_ident_t array_ident
= conf_get_ident(configfile
, dv
->devname
);
819 if (array_ident
== NULL
) {
820 fprintf(stderr
, Name
": %s not identified in config file.\n",
825 mdfd
= open_mddev(dv
->devname
, array_ident
->autof
);
830 rv
|= Assemble(ss
, dv
->devname
, mdfd
, array_ident
, configfile
,
832 readonly
, runstop
, update
, verbose
, force
);
836 mddev_ident_t array_list
= conf_get_ident(configfile
, NULL
);
838 fprintf(stderr
, Name
": No arrays found in config file\n");
841 for (; array_list
; array_list
= array_list
->next
) {
842 mdu_array_info_t array
;
843 mdfd
= open_mddev(array_list
->devname
, array_list
->autof
);
848 if (ioctl(mdfd
, GET_ARRAY_INFO
, &array
)>=0)
849 /* already assembled, skip */
852 rv
|= Assemble(ss
, array_list
->devname
, mdfd
,
853 array_list
, configfile
,
855 readonly
, runstop
, NULL
, verbose
, force
);
861 if (bitmap_chunk
== UnSet
) bitmap_chunk
= DEFAULT_BITMAP_CHUNK
;
862 if (delay
== 0) delay
= DEFAULT_BITMAP_DELAY
;
864 bitmap_fd
= open(bitmap_file
, O_RDWR
,0);
865 if (bitmap_fd
< 0 && errno
!= ENOENT
) {
866 perror(Name
": cannot create bitmap file");
871 bitmap_fd
= CreateBitmap(bitmap_file
, force
, NULL
,
872 bitmap_chunk
, delay
, size
);
875 rv
= Build(devlist
->devname
, mdfd
, chunk
, level
, layout
,
876 raiddisks
, devlist
->next
, assume_clean
,
877 bitmap_file
, bitmap_chunk
, delay
);
880 if (bitmap_chunk
== UnSet
) bitmap_chunk
= DEFAULT_BITMAP_CHUNK
;
881 if (delay
== 0) delay
= DEFAULT_BITMAP_DELAY
;
883 for(i
=0; !ss
&& superlist
[i
]; i
++)
884 ss
= superlist
[i
]->match_metadata_desc("default");
887 fprintf(stderr
, Name
": internal error - no default metadata style\n");
891 rv
= Create(ss
, devlist
->devname
, mdfd
, chunk
, level
, layout
, size
<0 ? 0 : size
,
892 raiddisks
, sparedisks
,
893 devs_found
-1, devlist
->next
, runstop
, verbose
, force
,
894 bitmap_file
, bitmap_chunk
, delay
);
898 if (devmode
== 'E') {
899 if (devlist
== NULL
&& !scan
) {
900 fprintf(stderr
, Name
": No devices to examine\n");
904 devlist
= conf_get_devs(configfile
);
905 if (devlist
== NULL
) {
906 fprintf(stderr
, Name
": No devices listed in %s\n", configfile
?configfile
:DefaultConfFile
);
909 rv
= Examine(devlist
, scan
?!verbose
:brief
, scan
, SparcAdjust
, ss
);
911 if (devlist
== NULL
) {
912 if ((devmode
== 'S' ||devmode
=='D') && scan
) {
913 /* apply to all devices in /proc/mdstat */
914 struct mdstat_ent
*ms
= mdstat_read(0);
915 struct mdstat_ent
*e
;
916 if (devmode
== 'S') {
917 /* reverse order so that arrays made of arrays are stopped properly */
918 struct mdstat_ent
*sm
= NULL
;
919 while ((e
=ms
) != NULL
) {
926 for (e
=ms
; e
; e
=e
->next
) {
927 char *name
= get_md_name(e
->devnum
);
930 fprintf(stderr
, Name
": cannot find device file for %s\n",
935 rv
|= Detail(name
, !verbose
, test
);
936 else if (devmode
=='S') {
937 mdfd
= open_mddev(name
, 0);
939 rv
|= Manage_runstop(name
, mdfd
, -1);
946 fprintf(stderr
, Name
": No devices given.\n");
950 for (dv
=devlist
; dv
; dv
=dv
->next
) {
951 switch(dv
->disposition
) {
953 rv
|= Detail(dv
->devname
, brief
, test
); continue;
954 case 'K': /* Zero superblock */
955 rv
|= Kill(dv
->devname
, force
); continue;
957 rv
|= Query(dv
->devname
); continue;
959 rv
|= ExamineBitmap(dv
->devname
, brief
); continue;
961 mdfd
= open_mddev(dv
->devname
, 0);
963 switch(dv
->disposition
) {
965 rv
|= Manage_runstop(dv
->devname
, mdfd
, 1); break;
967 rv
|= Manage_runstop(dv
->devname
, mdfd
, -1); break;
969 rv
|= Manage_ro(dv
->devname
, mdfd
, 1); break;
971 rv
|= Manage_ro(dv
->devname
, mdfd
, -1); break;
979 if (!devlist
&& !scan
) {
980 fprintf(stderr
, Name
": Cannot monitor: need --scan or at least one device\n");
984 if (pidfile
&& !daemonise
) {
985 fprintf(stderr
, Name
": Cannot write a pid file when not in daemon mode\n");
989 rv
= Monitor(devlist
, mailaddr
, program
,
990 delay
?delay
:60, daemonise
, scan
, oneshot
, configfile
, test
, pidfile
);
994 if (devs_found
> 1) {
997 if (size
>= 0 || raiddisks
) {
998 fprintf(stderr
, Name
": --size, --raiddisks, and --add are exclusing in --grow mode\n");
1002 for (dv
=devlist
->next
; dv
; dv
=dv
->next
) {
1003 rv
= Grow_Add_device(devlist
->devname
, mdfd
, dv
->devname
);
1007 } else if ((size
>= 0) + (raiddisks
!= 0) + (layout
!= UnSet
) > 1) {
1008 fprintf(stderr
, Name
": can change at most one of size, raiddisks, and layout\n");
1011 } else if (layout
!= UnSet
)
1012 rv
= Manage_reconfig(devlist
->devname
, mdfd
, layout
);
1013 else if (size
>= 0 || raiddisks
)
1014 rv
= Manage_resize(devlist
->devname
, mdfd
, size
, raiddisks
);
1016 fprintf(stderr
, Name
": no changes to --grow\n");