if (!st && ident->st) st = ident->st;
- if (verbose)
+ if (verbose>0)
fprintf(stderr, Name ": looking for devices for %s\n",
mddev);
if (ident->devices &&
!match_oneof(ident->devices, devname)) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": %s is not one of %s\n", devname, ident->devices);
continue;
}
dfd = open(devname, O_RDONLY|O_EXCL, 0);
if (dfd < 0) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": cannot open device %s: %s\n",
devname, strerror(errno));
} else if (fstat(dfd, &stb)< 0) {
devname);
close(dfd);
} else if (!tst && (tst = guess_super(dfd)) == NULL) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": no recogniseable superblock\n");
} else if (tst->ss->load_super(tst,dfd, &super, NULL)) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf( stderr, Name ": no RAID superblock on %s\n",
devname);
close(dfd);
if (ident->uuid_set &&
(!super || same_uuid(info.uuid, ident->uuid, tst->ss->swapuuid)==0)) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": %s has wrong uuid.\n",
devname);
continue;
}
if (ident->name[0] &&
(!super || strncmp(ident2.name, ident->name, 32)!=0)) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": %s has wrong name.\n",
devname);
continue;
}
if (ident->super_minor != UnSet &&
(!super || ident->super_minor != info.array.md_minor)) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": %s has wrong super-minor.\n",
devname);
continue;
}
if (ident->level != UnSet &&
(!super|| ident->level != info.array.level)) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": %s has wrong raid level.\n",
devname);
continue;
}
if (ident->raid_disks != UnSet &&
(!super || ident->raid_disks!= info.array.raid_disks)) {
- if (inargv || verbose)
+ if (inargv || verbose > 0)
fprintf(stderr, Name ": %s requires wrong number of drives.\n",
devname);
continue;
close(dfd);
}
- if (verbose)
+ if (verbose > 0)
fprintf(stderr, Name ": %s is identified as a member of %s, slot %d.\n",
devname, mddev, info.disk.raid_disk);
devices[devcnt].devname = devname;
}
if (chosen_drive < 0)
break;
- fprintf(stderr, Name ": forcing event count in %s(%d) from %d upto %d\n",
- devices[chosen_drive].devname, devices[chosen_drive].raid_disk,
- (int)(devices[chosen_drive].events),
- (int)(devices[most_recent].events));
+ if (verbose >= 0)
+ fprintf(stderr, Name ": forcing event count in %s(%d) from %d upto %d\n",
+ devices[chosen_drive].devname, devices[chosen_drive].raid_disk,
+ (int)(devices[chosen_drive].events),
+ (int)(devices[most_recent].events));
fd = open(devices[chosen_drive].devname, O_RDWR|O_EXCL);
if (fd < 0) {
fprintf(stderr, Name ": Couldn't open %s for write - not updating\n",
info.disk.state = desired_state;
if (devices[j].uptodate &&
- st->ss->update_super(&info, super, "assemble", NULL, 0)) {
+ st->ss->update_super(&info, super, "assemble", NULL, verbose)) {
if (force) {
- fprintf(stderr, Name ": "
- "clearing FAULTY flag for device %d in %s for %s\n",
- j, mddev, devices[j].devname);
+ if (verbose >= 0)
+ fprintf(stderr, Name ": "
+ "clearing FAULTY flag for device %d in %s for %s\n",
+ j, mddev, devices[j].devname);
change = 1;
} else {
- fprintf(stderr, Name ": "
- "device %d in %s has wrong state in superblock, but %s seems ok\n",
- i, mddev, devices[j].devname);
+ if (verbose >= -1)
+ fprintf(stderr, Name ": "
+ "device %d in %s has wrong state in superblock, but %s seems ok\n",
+ i, mddev, devices[j].devname);
}
}
#if 0
if (force && okcnt == info.array.raid_disks-1) {
/* FIXME check event count */
change += st->ss->update_super(&info, super, "force",
- devices[chosen_drive].devname, 0);
+ devices[chosen_drive].devname, verbose);
}
if (change) {
okcnt--;
else
sparecnt--;
- } else if (verbose)
+ } else if (verbose > 0)
fprintf(stderr, Name ": added %s to %s as %d\n",
devices[j].devname, mddev, devices[j].raid_disk);
- } else if (verbose && i < info.array.raid_disks)
+ } else if (verbose > 0 && i < info.array.raid_disks)
fprintf(stderr, Name ": no uptodate device for slot %d of %s\n",
i, mddev);
}
(okcnt >= req_cnt || start_partial_ok)
))) {
if (ioctl(mdfd, RUN_ARRAY, NULL)==0) {
- fprintf(stderr, Name ": %s has been started with %d drive%s",
- mddev, okcnt, okcnt==1?"":"s");
- if (okcnt < info.array.raid_disks)
- fprintf(stderr, " (out of %d)", info.array.raid_disks);
- if (sparecnt)
- fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
- fprintf(stderr, ".\n");
+ if (verbose >= 0) {
+ fprintf(stderr, Name ": %s has been started with %d drive%s",
+ mddev, okcnt, okcnt==1?"":"s");
+ if (okcnt < info.array.raid_disks)
+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
+ if (sparecnt)
+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
+ fprintf(stderr, ".\n");
+ }
return 0;
}
fprintf(stderr, Name ": failed to RUN_ARRAY %s: %s\n",
mddev, okcnt, okcnt==1?"":"s");
return 0;
}
- fprintf(stderr, Name ": %s assembled from %d drive%s", mddev, okcnt, okcnt==1?"":"s");
- if (sparecnt)
- fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
- if (!enough(info.array.level, info.array.raid_disks, okcnt))
- fprintf(stderr, " - not enough to start the array.\n");
- else {
- if (req_cnt == info.array.raid_disks)
- fprintf(stderr, " - need all %d to start it", req_cnt);
- else
- fprintf(stderr, " - need %d of %d to start", req_cnt, info.array.raid_disks);
- fprintf(stderr, " (use --run to insist).\n");
+ if (verbose >= 0) {
+ fprintf(stderr, Name ": %s assembled from %d drive%s", mddev, okcnt, okcnt==1?"":"s");
+ if (sparecnt)
+ fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
+ if (!enough(info.array.level, info.array.raid_disks, okcnt))
+ fprintf(stderr, " - not enough to start the array.\n");
+ else {
+ if (req_cnt == info.array.raid_disks)
+ fprintf(stderr, " - need all %d to start it", req_cnt);
+ else
+ fprintf(stderr, " - need %d of %d to start", req_cnt, info.array.raid_disks);
+ fprintf(stderr, " (use --run to insist).\n");
+ }
}
return 1;
} else {
int Build(char *mddev, int mdfd, int chunk, int level, int layout,
int raiddisks,
mddev_dev_t devlist, int assume_clean,
- char *bitmap_file, int bitmap_chunk, int write_behind, int delay)
+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int verbose)
{
/* Build a linear or raid0 arrays without superblocks
* We cannot really do any checks, we just do it.
* SET_ARRAY_INFO, ADD_NEW_DISK, RUN_ARRAY
*
*/
- int verbose = 0;
int i;
int vers;
struct stat stb;
break;
case 10:
layout = 0x102; /* near=2, far=1 */
- if (verbose)
+ if (verbose > 0)
fprintf(stderr,
Name ": layout defaults to n1\n");
break;
case 5:
case 6:
layout = map_name(r5layout, "default");
- if (verbose)
+ if (verbose > 0)
fprintf(stderr,
Name ": layout defaults to %s\n", map_num(r5layout, layout));
break;
case LEVEL_FAULTY:
layout = map_name(faultylayout, "default");
- if (verbose)
+ if (verbose > 0)
fprintf(stderr,
Name ": layout defaults to %s\n", map_num(faultylayout, layout));
break;
goto abort;
}
}
- fprintf(stderr, Name ": array %s built and started.\n",
- mddev);
+ if (verbose >= 0)
+ fprintf(stderr, Name ": array %s built and started.\n",
+ mddev);
return 0;
abort:
break;
case 10:
layout = 0x102; /* near=2, far=1 */
- if (verbose)
+ if (verbose > 0)
fprintf(stderr,
Name ": layout defaults to n1\n");
break;
case 5:
case 6:
layout = map_name(r5layout, "default");
- if (verbose)
+ if (verbose > 0)
fprintf(stderr,
Name ": layout defaults to %s\n", map_num(r5layout, layout));
break;
case LEVEL_FAULTY:
layout = map_name(faultylayout, "default");
- if (verbose)
+ if (verbose > 0)
fprintf(stderr,
Name ": layout defaults to %s\n", map_num(faultylayout, layout));
break;
case -1: /* linear */
if (chunk == 0) {
chunk = 64;
- if (verbose)
+ if (verbose > 0)
fprintf(stderr, Name ": chunk size defaults to 64K\n");
}
break;
default: /* raid1, multipath */
if (chunk) {
chunk = 0;
- if (verbose)
+ if (verbose > 0)
fprintf(stderr, Name ": chunk size ignored for this level\n");
}
break;
mindisc = dname;
minsize = freesize;
}
- warn |= check_ext2(fd, dname);
- warn |= check_reiser(fd, dname);
- warn |= check_raid(fd, dname);
+ if (runstop != 1 || verbose >= 0) {
+ warn |= check_ext2(fd, dname);
+ warn |= check_reiser(fd, dname);
+ warn |= check_raid(fd, dname);
+ }
close(fd);
}
if (fail) {
return 1;
}
size = minsize;
- if (verbose)
+ if (verbose > 0)
fprintf(stderr, Name ": size set to %luK\n", size);
}
}
if (level > 0 && ((maxsize-size)*100 > maxsize)) {
- fprintf(stderr, Name ": largest drive (%s) exceed size (%luK) by more than 1%%\n",
- maxdisc, size);
+ if (runstop != 1 || verbose >= 0)
+ fprintf(stderr, Name ": largest drive (%s) exceed size (%luK) by more than 1%%\n",
+ maxdisc, size);
warn = 1;
}
return 1;
}
} else {
- if (verbose)
+ if (verbose > 0)
fprintf(stderr, Name ": creation continuing despite oddities due to --run\n");
}
}
Manage_runstop(mddev, mdfd, -1, 0);
return 1;
}
- fprintf(stderr, Name ": array %s started.\n", mddev);
+ if (verbose >= 0)
+ fprintf(stderr, Name ": array %s started.\n", mddev);
} else {
fprintf(stderr, Name ": not starting array - not enough devices.\n");
}
if (err) rv =1;
if (SparcAdjust)
- st->ss->update_super(NULL, super, "sparc2.2", devlist->devname, 0);
+ st->ss->update_super(NULL, super, "sparc2.2", devlist->devname, 0);
/* Ok, its good enough to try, though the checksum could be wrong */
if (brief) {
struct array *ap;
}
int Manage_subdevs(char *devname, int fd,
- mddev_dev_t devlist)
+ mddev_dev_t devlist, int verbose)
{
/* do something to each dev.
* devmode can be
md_get_version(fd)%100 < 2) {
if (ioctl(fd, HOT_ADD_DISK,
(unsigned long)stb.st_rdev)==0) {
- fprintf(stderr, Name ": hot added %s\n",
- dv->devname);
+ if (verbose >= 0)
+ fprintf(stderr, Name ": hot added %s\n",
+ dv->devname);
continue;
}
dv->devname, j, strerror(errno));
return 1;
}
- fprintf(stderr, Name ": added %s\n", dv->devname);
+ if (verbose >= 0)
+ fprintf(stderr, Name ": added %s\n", dv->devname);
break;
case 'r':
dv->devname, strerror(errno));
return 1;
}
- fprintf(stderr, Name ": hot removed %s\n", dv->devname);
+ if (verbose >= 0)
+ fprintf(stderr, Name ": hot removed %s\n", dv->devname);
break;
case 'f': /* set faulty */
dv->devname, strerror(errno));
return 1;
}
- fprintf(stderr, Name ": set %s faulty in %s\n",
- dv->devname, devname);
+ if (verbose >= 0)
+ fprintf(stderr, Name ": set %s faulty in %s\n",
+ dv->devname, devname);
break;
}
}
* At the time if writing, there is only minimal support.
*/
-char short_options[]="-ABCDEFGQhVXvb::c:i:l:p:m:n:x:u:c:d:z:U:sa::rfRSow1te:";
+char short_options[]="-ABCDEFGQhVXvqb::c:i:l:p:m:n:x:u:c:d:z:U:sa::rfRSow1te:";
struct option long_options[] = {
{"manage", 0, 0, '@'},
{"misc", 0, 0, '#'},
{"help-options",0,0,'h'},
{"version", 0, 0, 'V'},
{"verbose", 0, 0, 'v'},
+ {"quiet", 0, 0, 'q'},
/* For create or build: */
{"chunk", 1, 0, 'c'},
" --help-options : This help message\n"
" --version -V : Print version information for mdadm\n"
" --verbose -v : Be more verbose about what is happening\n"
+" --quiet -q : Don't print un-necessary messages\n"
" --brief -b : Be less verbose, more brief\n"
" --force -f : Override normal checks and be more forceful\n"
"\n"
and
.BR "--examine --scan" .
+.TP
+.BR -q ", " --quiet
+Avoid printing purely informative messages. With this,
+.B mdadm
+will be silent unless there is something really important to report.
+
.TP
.BR -b ", " --brief
Be less verbose. This is used with
mddev_dev_t dv;
int devs_found = 0;
int verbose = 0;
+ int quiet = 0;
int brief = 0;
int force = 0;
int test = 0;
short_options, long_options,
&option_index)) != -1) {
int newmode = mode;
- /* firstly, so mode-independant options */
+ /* firstly, some mode-independant options */
switch(opt) {
case 'h':
help_text = Help;
case 'v': verbose++;
continue;
+ case 'q': quiet++;
+ continue;
+
case 'b':
if (mode == ASSEMBLE || mode == BUILD || mode == CREATE || mode == GROW)
break; /* b means bitmap */
rv = Manage_ro(devlist->devname, mdfd, readonly);
if (!rv && devs_found>1)
rv = Manage_subdevs(devlist->devname, mdfd,
- devlist->next);
+ devlist->next, verbose-quiet);
if (!rv && readonly < 0)
rv = Manage_ro(devlist->devname, mdfd, readonly);
if (!rv && runstop)
else {
rv |= Assemble(ss, devlist->devname, mdfd, array_ident, configfile,
NULL,
- readonly, runstop, update, verbose, force);
+ readonly, runstop, update, verbose-quiet, force);
close(mdfd);
}
}
} else if (!scan)
rv = Assemble(ss, devlist->devname, mdfd, &ident, configfile,
devlist->next,
- readonly, runstop, update, verbose, force);
+ readonly, runstop, update, verbose-quiet, force);
else if (devs_found>0) {
if (update && devs_found > 1) {
fprintf(stderr, Name ": can only update a single array at a time\n");
}
rv |= Assemble(ss, dv->devname, mdfd, array_ident, configfile,
NULL,
- readonly, runstop, update, verbose, force);
+ readonly, runstop, update, verbose-quiet, force);
close(mdfd);
}
} else {
rv |= Assemble(ss, array_list->devname, mdfd,
array_list, configfile,
NULL,
- readonly, runstop, NULL, verbose, force);
+ readonly, runstop, NULL, verbose-quiet, force);
close(mdfd);
}
}
}
rv = Build(devlist->devname, mdfd, chunk, level, layout,
raiddisks, devlist->next, assume_clean,
- bitmap_file, bitmap_chunk, write_behind, delay);
+ bitmap_file, bitmap_chunk, write_behind, delay, verbose-quiet);
break;
case CREATE:
if (delay == 0) delay = DEFAULT_BITMAP_DELAY;
rv = Create(ss, devlist->devname, mdfd, chunk, level, layout, size<0 ? 0 : size,
raiddisks, sparedisks, ident.name,
- devs_found-1, devlist->next, runstop, verbose, force,
+ devs_found-1, devlist->next, runstop, verbose-quiet, force,
bitmap_file, bitmap_chunk, write_behind, delay);
break;
case MISC:
extern int Manage_resize(char *devname, int fd, long long size, int raid_disks);
extern int Manage_reconfig(char *devname, int fd, int layout);
extern int Manage_subdevs(char *devname, int fd,
- mddev_dev_t devlist);
+ mddev_dev_t devlist, int verbose);
extern int Grow_Add_device(char *devname, int fd, char *newdev);
extern int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind);
extern int Build(char *mddev, int mdfd, int chunk, int level, int layout,
int raiddisks,
mddev_dev_t devlist, int assume_clean,
- char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
+ char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int verbose);
extern int Create(struct supertype *st, char *mddev, int mdfd,
memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
(MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
- fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatability.\n",
- devname);
+ if (verbose >= 0)
+ fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatability.\n",
+ devname);
}
if (strcmp(update, "super-minor") ==0) {
sb->md_minor = info->array.md_minor;
- if (verbose)
+ if (verbose > 0)
fprintf(stderr, Name ": updating superblock of %s with minor number %d\n",
devname, info->array.md_minor);
}
dir=`pwd`
mdadm=$dir/mdadm
-export mdadm
if [ \! -x $mdadm ]
then
echo >&2 "test: $mdadm isn't usable."
export check="sh $dir/tests/check"
# assume md0, md1, md2 exist in /dev
-export md0=/dev/md0 md1=/dev/md1 md2=/dev/md2
+md0=/dev/md0 md1=/dev/md1 md2=/dev/md2
# We test mdadm on loop-back block devices.
# dir for storing files should be settable by command line maybe
targetdir=/tmp
-export targetdir dir
size=20000
mdsize0=19904
mdsize1=19992
-export size mdsize0 mdsize1
cleanup() {
$mdadm -Ss
do
[ -f $targetdir/mdtest$d ] || dd if=/dev/zero of=$targetdir/mdtest$d count=$size bs=1K > /dev/null 2>&1
losetup /dev/loop$d $targetdir/mdtest$d
- export dev$d=/dev/loop$d
+ eval dev$d=/dev/loop$d
eval devlist=\"\$devlist \$dev$d\"
done
-export devlist
+
+# mdadm always adds --quiet, and we want to see any unexpected messages
+mdadm() {
+ $mdadm 2>&1 --quiet "$@"
+}
+
+# check various things
+check() {
+ case $1 in
+ raid* | linear )
+ grep -s "active $1 " /proc/mdstat > /dev/null || {
+ echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;}
+ ;;
+ resync | recovery )
+ sleep 0.1
+ grep -s $1 /proc/mdstat > /dev/null || {
+ echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; }
+ ;;
+
+ nosync )
+ sleep 0.5
+ if grep -s 're[synccovery]* =' > /dev/null /proc/mdstat ; then
+ echo >&2 "ERROR resync or recovery is happening!"; cat /proc/mdstat ; exit 1;
+ fi
+ ;;
+
+ wait )
+ sleep 0.1
+ while grep 're[synccovery]* =' > /dev/null /proc/mdstat
+ do sleep 2;
+ done
+ ;;
+
+ state )
+ grep -s "blocks.*\[$2\]\$" /proc/mdstat > /dev/null || {
+ echo >&2 "ERROR state $2 not found!"; cat /proc/mdstat ; exit 1; }
+ sleep 0.5
+ ;;
+
+ * ) echo >&2 ERROR unknown check $1 ; exit 1;
+ esac
+}
+
+# basic device test
+
+testdev() {
+ dev=$1
+ cnt=$2
+ dvsize=$3
+ chunk=$4
+ mkfs -j $dev > /dev/null 2>&1 && fsck -fn $dev >&2
+ dsize=$[dvsize/chunk]
+ dsize=$[dsize*chunk]
+ rasize=$[dsize*1024*cnt]
+ if [ $rasize -ne `/sbin/blockdev --getsize64 $dev` ]
+ then
+ echo "ERROR: size is wrong for $dev: $cnt * $dvsize (chunk=$chunk) = $rasize, not `/sbin/blockdev --getsize64 $dev`"
+ exit 1
+ fi
+}
+
for script in tests/$prefix*[^~]
do
- if sh -x $script > $targetdir/log 2>&1
- then echo "$script succeeded"
+ # source script in a subshell, so it has access to our
+ # namespace, but cannot change it.
+ if ( set -ex ; . $script ) 2> $targetdir/log
+ then echo "$script succeeded"
else cat $targetdir/log
echo "$script failed"
exit 1
# create a simple linear
-set -ex
-$mdadm -CR $md0 -l linear -n3 $dev0 $dev1 $dev2
-$check linear
-sh tests/testdev $md0 3 $mdsize0 64
-$mdadm -S $md0
+mdadm -CR $md0 -l linear -n3 $dev0 $dev1 $dev2
+check linear
+testdev $md0 3 $mdsize0 64
+mdadm -S $md0
# now with verion-1 superblock
-$mdadm -CR $md0 -e1 --level=linear -n4 $dev0 $dev1 $dev2 $dev3
-$check linear
-sh tests/testdev $md0 4 $mdsize1 64
-$mdadm -S $md0
+mdadm -CR $md0 -e1 --level=linear -n4 $dev0 $dev1 $dev2 $dev3
+check linear
+testdev $md0 4 $mdsize1 64
+mdadm -S $md0
# now with no superblock
-$mdadm -B $md0 -l linear -n5 $dev0 $dev1 $dev2 $dev3 $dev4
-$check linear
-sh tests/testdev $md0 5 $size 64
-$mdadm -S $md0
+mdadm -B $md0 -l linear -n5 $dev0 $dev1 $dev2 $dev3 $dev4
+check linear
+testdev $md0 5 $size 64
+mdadm -S $md0
-exit 0
# create a simple raid0
-set -e
-$mdadm -CR $md0 -l raid0 -n3 $dev0 $dev1 $dev2
-$check raid0
-sh tests/testdev $md0 3 $mdsize0 64
-$mdadm -S $md0
+mdadm -CR $md0 -l raid0 -n3 $dev0 $dev1 $dev2
+check raid0
+testdev $md0 3 $mdsize0 64
+mdadm -S $md0
# now with verion-1 superblock
-$mdadm -CR $md0 -e1 -l0 -n4 $dev0 $dev1 $dev2 $dev3
-$check raid0
-sh tests/testdev $md0 4 $mdsize1 64
-$mdadm -S $md0
+mdadm -CR $md0 -e1 -l0 -n4 $dev0 $dev1 $dev2 $dev3
+check raid0
+testdev $md0 4 $mdsize1 64
+mdadm -S $md0
# now with no superblock
-$mdadm -B $md0 -l0 -n5 $dev0 $dev1 $dev2 $dev3 $dev4
-$check raid0
-sh tests/testdev $md0 5 $size 64
-$mdadm -S $md0
+mdadm -B $md0 -l0 -n5 $dev0 $dev1 $dev2 $dev3 $dev4
+check raid0
+testdev $md0 5 $size 64
+mdadm -S $md0
# now same again with different chunk size
for chunk in 4 32 256
do
- $mdadm -CR $md0 -l raid0 --chunk $chunk -n3 $dev0 $dev1 $dev2
- $check raid0
- sh tests/testdev $md0 3 $mdsize0 $chunk
- $mdadm -S $md0
+ mdadm -CR $md0 -l raid0 --chunk $chunk -n3 $dev0 $dev1 $dev2
+ check raid0
+ testdev $md0 3 $mdsize0 $chunk
+ mdadm -S $md0
# now with verion-1 superblock
- $mdadm -CR $md0 -e1 -l0 -c $chunk -n4 $dev0 $dev1 $dev2 $dev3
- $check raid0
- sh tests/testdev $md0 4 $mdsize1 $chunk
- $mdadm -S $md0
+ mdadm -CR $md0 -e1 -l0 -c $chunk -n4 $dev0 $dev1 $dev2 $dev3
+ check raid0
+ testdev $md0 4 $mdsize1 $chunk
+ mdadm -S $md0
# now with no superblock
- $mdadm -B $md0 -l0 -n5 --chun=$chunk $dev0 $dev1 $dev2 $dev3 $dev4
- $check raid0
- sh tests/testdev $md0 5 $size $chunk
- $mdadm -S $md0
+ mdadm -B $md0 -l0 -n5 --chun=$chunk $dev0 $dev1 $dev2 $dev3 $dev4
+ check raid0
+ testdev $md0 5 $size $chunk
+ mdadm -S $md0
done
exit 0
# test resync and recovery.
set -e
-$mdadm -CR $md0 -l 1 -n2 $dev0 $dev1
-$check resync
-$check raid1
-sh tests/testdev $md0 1 $mdsize0 1
-$mdadm -S $md0
+mdadm -CR $md0 -l 1 -n2 $dev0 $dev1
+check resync
+check raid1
+testdev $md0 1 $mdsize0 1
+mdadm -S $md0
# now with verion-1 superblock, spare
-$mdadm -CR $md0 -e1 --level=raid1 -n3 -x2 $dev0 missing missing $dev1 $dev2
-$check recovery
-$check raid1
-sh tests/testdev $md0 1 $mdsize1 1
-$mdadm -S $md0
+mdadm -CR $md0 -e1 --level=raid1 -n3 -x2 $dev0 missing missing $dev1 $dev2
+check recovery
+check raid1
+testdev $md0 1 $mdsize1 1
+mdadm -S $md0
# now with no superblock
-$mdadm -B $md0 -l mirror -n2 $dev0 $dev1
-$check resync
-$check raid1
-sh tests/testdev $md0 1 $size 1
-$mdadm -S $md0
+mdadm -B $md0 -l mirror -n2 $dev0 $dev1
+check resync
+check raid1
+testdev $md0 1 $size 1
+mdadm -S $md0
# again, but with no resync
-$mdadm -B $md0 -l 1 --assume-clean -n2 $dev0 $dev1
-$check raid1
-$check nosync
-sh tests/testdev $md0 1 $size 1
-$mdadm -S $md0
+mdadm -B $md0 -l 1 --assume-clean -n2 $dev0 $dev1
+check raid1
+check nosync
+testdev $md0 1 $size 1
+mdadm -S $md0
exit 0
n2 ) m=3;;
n3 ) m=2;;
esac
- $mdadm --create --run --level=raid10 --layout $lo --raid-disks 6 -x 1 $md0 $devs
- $check resync ; $check raid10
- sh tests/testdev $md0 $m $mdsize0 $[64*cm]
- $mdadm -S $md0
+ mdadm --create --run --level=raid10 --layout $lo --raid-disks 6 -x 1 $md0 $devs
+ check resync ; check raid10
+ testdev $md0 $m $mdsize0 $[64*cm]
+ mdadm -S $md0
done
# create a simple raid4 set
-set -e
-$mdadm -CfR $md0 -l 4 -n3 $dev0 $dev1 $dev2
-$check resync ; $check raid5
-sh tests/testdev $md0 2 $mdsize0 64
-$mdadm -S $md0
+mdadm -CfR $md0 -l 4 -n3 $dev0 $dev1 $dev2
+check resync ; check raid5
+testdev $md0 2 $mdsize0 64
+mdadm -S $md0
# now with verion-1 superblock
-$mdadm -CR $md0 -e1 --level=raid4 -n4 $dev0 $dev1 $dev2 $dev3
-$check resync; $check raid5
-sh tests/testdev $md0 3 $mdsize1 64
-$mdadm -S $md0
+mdadm -CR $md0 -e1 --level=raid4 -n4 $dev0 $dev1 $dev2 $dev3
+check resync; check raid5
+testdev $md0 3 $mdsize1 64
+mdadm -S $md0
exit 0
# create a simple raid5 set
-set -e
-$mdadm -CfR $md0 -l 5 -n3 $dev0 $dev1 $dev2
-$check resync
-sh tests/testdev $md0 2 $mdsize0 64
-$mdadm -S $md0
+mdadm -CfR $md0 -l 5 -n3 $dev0 $dev1 $dev2
+check resync
+testdev $md0 2 $mdsize0 64
+mdadm -S $md0
# now with verion-1 superblock
-$mdadm -CR $md0 -e1 --level=raid5 -n4 $dev0 $dev1 $dev2 $dev3
-$check recovery
-sh tests/testdev $md0 3 $mdsize1 64
-$mdadm -S $md0
+mdadm -CR $md0 -e1 --level=raid5 -n4 $dev0 $dev1 $dev2 $dev3
+check recovery
+testdev $md0 3 $mdsize1 64
+mdadm -S $md0
# now same again with explicit layout
for lo in la ra left-symmetric right-symmetric
do
- $mdadm -CfR $md0 -l 5 -p $lo -n3 $dev0 $dev1 $dev2
- $check resync ; $check raid5
- sh tests/testdev $md0 2 $mdsize0 64
- $mdadm -S $md0
+ mdadm -CfR $md0 -l 5 -p $lo -n3 $dev0 $dev1 $dev2
+ check resync ; check raid5
+ testdev $md0 2 $mdsize0 64
+ mdadm -S $md0
# now with verion-1 superblock
- $mdadm -CR $md0 -e1 --level=raid5 --layout $lo -n4 $dev0 $dev1 $dev2 $dev3
- $check recovery ; $check raid5
- sh tests/testdev $md0 3 $mdsize1 64
- $mdadm -S $md0
+ mdadm -CR $md0 -e1 --level=raid5 --layout $lo -n4 $dev0 $dev1 $dev2 $dev3
+ check recovery ; check raid5
+ testdev $md0 3 $mdsize1 64
+ mdadm -S $md0
done
# create a simple raid6 set
-set -e
-$mdadm -CfR $md0 -l 6 -n4 $dev0 $dev1 $dev2 $dev3
-$check resync ; $check raid6
-sh tests/testdev $md0 2 $mdsize0 64
-$mdadm -S $md0
+mdadm -CfR $md0 -l 6 -n4 $dev0 $dev1 $dev2 $dev3
+check resync ; check raid6
+testdev $md0 2 $mdsize0 64
+mdadm -S $md0
# now with verion-1 superblock
-$mdadm -CR $md0 -e1 --level=raid6 -n5 $dev0 $dev1 $dev2 $dev3 $dev4
-$check resync ; $check raid6
-sh tests/testdev $md0 3 $mdsize1 64
-$mdadm -S $md0
+mdadm -CR $md0 -e1 --level=raid6 -n5 $dev0 $dev1 $dev2 $dev3 $dev4
+check resync ; check raid6
+testdev $md0 3 $mdsize1 64
+mdadm -S $md0
exit 0
-set -e
-
# create a raid1, fail and remove a drive during initial sync
# Add two more, fail and remove one
# wait for sync to complete, fail, remove, re-add
-$mdadm -CR $md0 -l1 -n4 $dev0 $dev1 $dev2 missing
-$check resync
-$mdadm $md0 --fail $dev2
-$check resync
-$mdadm $md0 --fail $dev1
+mdadm -CR $md0 -l1 -n4 $dev0 $dev1 $dev2 missing
+check resync
+mdadm $md0 --fail $dev2
+check resync
+mdadm $md0 --fail $dev1
sleep 1
-$check nosync
-$check state U___
-$mdadm $md0 --add $dev4 $dev3
-$check recovery
+check nosync
+check state U___
+mdadm $md0 --add $dev4 $dev3
+check recovery
# there could be two separate recoveries, one for each dev
-$check wait
-$check wait
-$mdadm $md0 --remove $dev2 $dev1
-$check nosync
-$check state UUU_
+check wait
+check wait
+mdadm $md0 --remove $dev2 $dev1
+check nosync
+check state UUU_
-$mdadm $md0 -a $dev2
-$check recovery
-$check wait
-$check state UUUU
+mdadm $md0 -a $dev2
+check recovery
+check wait
+check state UUUU
-$mdadm -S $md0
+mdadm -S $md0
# Add two more, fail and remove one
# wait for sync to complete, fail, remove, re-add
-$mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3
-$check recovery
-$mdadm $md0 --fail $dev3
-$check nosync
-$check state UUU_
+mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3
+check recovery
+mdadm $md0 --fail $dev3
+check nosync
+check state UUU_
-$mdadm $md0 --add $dev4 $dev5
-$check recovery
-$check wait
-$mdadm $md0 --fail $dev0
-$mdadm $md0 --remove $dev3 $dev0
-$check recovery
-$check state _UUU
+mdadm $md0 --add $dev4 $dev5
+check recovery
+check wait
+mdadm $md0 --fail $dev0
+mdadm $md0 --remove $dev3 $dev0
+check recovery
+check state _UUU
-$mdadm $md0 -a $dev3
-$check recovery
-$check wait
-$check state UUUU
+mdadm $md0 -a $dev3
+check recovery
+check wait
+check state UUUU
-$mdadm -S $md0
\ No newline at end of file
+mdadm -S $md0
\ No newline at end of file
set -e
# Make a raid1, add a device, then remove it again.
-$mdadm -CR $md0 -l1 -n2 -x1 $dev0 $dev1 $dev2
-$check resync
-$check wait
-$check state UU
+mdadm -CR $md0 -l1 -n2 -x1 $dev0 $dev1 $dev2
+check resync
+check wait
+check state UU
-$mdadm --grow $md0 -n 3
-$check recovery
-$check wait
-$check state UUU
+mdadm --grow $md0 -n 3
+check recovery
+check wait
+check state UUU
-$mdadm $md0 --fail $dev0
-$check state _UU
+mdadm $md0 --fail $dev0
+check state _UU
-$mdadm --grow $md0 -n 2
-$check state UU
+mdadm --grow $md0 -n 2
+check state UU
-$mdadm -S $md0
+mdadm -S $md0
# same again for version-1
-$mdadm -CR $md0 -l1 -n2 -e1.2 -x1 $dev0 $dev1 $dev2
-$check resync
-$check wait
-$check state UU
+mdadm -CR $md0 -l1 -n2 -e1.2 -x1 $dev0 $dev1 $dev2
+check resync
+check wait
+check state UU
-$mdadm --grow $md0 -n 3
-$check recovery
-$check wait
-$check state UUU
+mdadm --grow $md0 -n 3
+check recovery
+check wait
+check state UUU
-$mdadm $md0 --fail $dev0
-$check state _UU
+mdadm $md0 --fail $dev0
+check state _UU
-$mdadm --grow $md0 -n 2
-$check state UU
+mdadm --grow $md0 -n 2
+check state UU
-$mdadm -S $md0
+mdadm -S $md0
# create a small raid1 array, make it larger. Then make it smaller
-$mdadm -CR $md0 --level raid1 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
-$check wait
-$check state UUU
-sh tests/testdev $md0 1 $[size/2] 1
+mdadm -CR $md0 --level raid1 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
+check wait
+check state UUU
+testdev $md0 1 $[size/2] 1
-$mdadm --grow $md0 --size max
-$check resync
-$check wait
-sh tests/testdev $md0 1 $mdsize0 1
+mdadm --grow $md0 --size max
+check resync
+check wait
+testdev $md0 1 $mdsize0 1
-$mdadm --grow $md0 --size $[size/2]
-$check nosync
-sh tests/testdev $md0 1 $[size/2] 1
+mdadm --grow $md0 --size $[size/2]
+check nosync
+testdev $md0 1 $[size/2] 1
-$mdadm -S $md0
+mdadm -S $md0
# same again with version 1.1 superblock
-$mdadm -CR $md0 --level raid1 --metadata=1.1 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
-$check wait
-$check state UUU
-sh tests/testdev $md0 1 $[size/2] 1
+mdadm -CR $md0 --level raid1 --metadata=1.1 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
+check wait
+check state UUU
+testdev $md0 1 $[size/2] 1
-$mdadm --grow $md0 --size max
-$check resync
-$check wait
-sh tests/testdev $md0 1 $[size-1] 1
+mdadm --grow $md0 --size max
+check resync
+check wait
+testdev $md0 1 $[size-1] 1
-$mdadm --grow $md0 --size $[size/2]
-$check nosync
-sh tests/testdev $md0 1 $[size/2] 1
+mdadm --grow $md0 --size $[size/2]
+check nosync
+testdev $md0 1 $[size/2] 1
-$mdadm -S $md0
+mdadm -S $md0
# create a small raid5 array, make it larger. Then make it smaller
-$mdadm -CR $md0 --level raid5 --chunk=32 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
-$check wait
-$check state UUU
-sh tests/testdev $md0 2 $[size/2] 32
+mdadm -CR $md0 --level raid5 --chunk=32 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
+check wait
+check state UUU
+testdev $md0 2 $[size/2] 32
-$mdadm --grow $md0 --size max
-$check resync
-$check wait
-sh tests/testdev $md0 2 $mdsize0 64
+mdadm --grow $md0 --size max
+check resync
+check wait
+testdev $md0 2 $mdsize0 64
-$mdadm --grow $md0 --size $[size/2]
-$check nosync
-sh tests/testdev $md0 2 $[size/2] 64
+mdadm --grow $md0 --size $[size/2]
+check nosync
+testdev $md0 2 $[size/2] 64
-$mdadm -S $md0
+mdadm -S $md0
# same again with version 1.1 superblock
-$mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=128 --raid-disks 4 --size $[size/2] $dev1 $dev2 $dev3 $dev4
-$check wait
-$check state UUUU
+mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=128 --raid-disks 4 --size $[size/2] $dev1 $dev2 $dev3 $dev4
+check wait
+check state UUUU
+testdev $md0 3 $[size/2] 128
+
+mdadm --grow $md0 --size max
+check resync
+check wait
+testdev $md0 3 $[size-1] 128
+
+mdadm --grow $md0 --size $[size/2]
+check nosync
sh tests/testdev $md0 3 $[size/2] 128
-$mdadm --grow $md0 --size max
-$check resync
-$check wait
-sh tests/testdev $md0 3 $[size-1] 128
-
-$mdadm --grow $md0 --size $[size/2]
-$check nosync
-sh tests/testdev $md0 3 $[size/2] 128
-
-$mdadm -S $md0
+mdadm -S $md0
# create a small raid6 array, make it larger. Then make it smaller
-$mdadm -CR $md0 --level raid6 --chunk=32 --raid-disks 4 --size $[size/2] $dev1 $dev2 $dev3 $dev4
-$check wait
-$check state UUUU
-sh tests/testdev $md0 2 $[size/2] 32
+mdadm -CR $md0 --level raid6 --chunk=32 --raid-disks 4 --size $[size/2] $dev1 $dev2 $dev3 $dev4
+check wait
+check state UUUU
+testdev $md0 2 $[size/2] 32
-$mdadm --grow $md0 --size max
-$check resync
-$check wait
-sh tests/testdev $md0 2 $mdsize0 64
+mdadm --grow $md0 --size max
+check resync
+check wait
+testdev $md0 2 $mdsize0 64
-$mdadm --grow $md0 --size $[size/2]
-$check nosync
-sh tests/testdev $md0 2 $[size/2] 64
+mdadm --grow $md0 --size $[size/2]
+check nosync
+testdev $md0 2 $[size/2] 64
-$mdadm -S $md0
+mdadm -S $md0
# same again with version 1.1 superblock
-$mdadm -CR $md0 --level raid6 --metadata=1.1 --chunk=128 --raid-disks 4 --size $[size/2] $dev1 $dev2 $dev3 $dev4
-$check wait
-$check state UUUU
-sh tests/testdev $md0 2 $[size/2] 128
+mdadm -CR $md0 --level raid6 --metadata=1.1 --chunk=128 --raid-disks 4 --size $[size/2] $dev1 $dev2 $dev3 $dev4
+check wait
+check state UUUU
+testdev $md0 2 $[size/2] 128
-$mdadm --grow $md0 --size max
-$check resync
-$check wait
-sh tests/testdev $md0 2 $[size-1] 128
+mdadm --grow $md0 --size max
+check resync
+check wait
+testdev $md0 2 $[size-1] 128
-$mdadm --grow $md0 --size $[size/2]
-$check nosync
-sh tests/testdev $md0 2 $[size/2] 128
+mdadm --grow $md0 --size $[size/2]
+check nosync
+testdev $md0 2 $[size/2] 128
-$mdadm -S $md0
+mdadm -S $md0
-set -e
# create a raid0 array from 3 devices, and assemble it in a multitude of ways.
# explicitly list devices
# uuid, md-minor on command line with wildcard devices
# mdadm.conf file
-$mdadm -CR $md2 -l0 -n3 $dev0 $dev1 $dev2
-$check raid0
-tst="sh tests/testdev $md2 3 $mdsize0 64"
+mdadm -CR $md2 -l0 -n3 $dev0 $dev1 $dev2
+check raid0
+tst="testdev $md2 3 $mdsize0 64"
$tst
-uuid=`$mdadm -Db $md2 | sed 's/.*UUID=//'`
-$mdadm -S $md2
+uuid=`mdadm -Db $md2 | sed 's/.*UUID=//'`
+mdadm -S $md2
-$mdadm -A $md2 $dev0 $dev1 $dev2
+mdadm -A $md2 $dev0 $dev1 $dev2
$tst
-$mdadm -S $md2
+mdadm -S $md2
-$mdadm -A $md2 -u $uuid $devlist
+mdadm -A $md2 -u $uuid $devlist
$tst
-$mdadm -S $md2
+mdadm -S $md2
-$mdadm --assemble $md2 --super-minor=2 $devlist
+mdadm --assemble $md2 --super-minor=2 $devlist
$tst
-$mdadm -S $md2
+mdadm -S $md2
conf=$targetdir/mdadm.conf
{
echo array $md2 UUID=$uuid
} > $conf
-$mdadm -As -c $conf $md2
+mdadm -As -c $conf $md2
$tst
-$mdadm -S $md2
+mdadm -S $md2
{
echo DEVICE $devlist
echo array $md2 super-minor=2
} > $conf
-$mdadm -As -c $conf $md2
+mdadm -As -c $conf $md2
$tst
-$mdadm -S $md2
+mdadm -S $md2
{
echo array $md2 devices=$dev0,$dev1,$dev2
} > $conf
-$mdadm -As -c $conf $md2
+mdadm -As -c $conf $md2
$tst
echo "DEVICE $devlist" > $conf
-$mdadm -Db $md2 >> $conf
-$mdadm -S $md2
+mdadm -Db $md2 >> $conf
+mdadm -S $md2
-$mdadm --assemble --scan --config=$conf $md2
+mdadm --assemble --scan --config=$conf $md2
$tst
-$mdadm -S $md2
+mdadm -S $md2
echo " metadata=0.90 devices=$dev0,$dev1,$dev2" >> $conf
-$mdadm --assemble --scan --config=$conf $md2
+mdadm --assemble --scan --config=$conf $md2
$tst
-$mdadm -S $md2
+mdadm -S $md2
### Now for version 1...
-$mdadm -CR $md2 -l0 --metadata=1.0 -n3 $dev0 $dev1 $dev2
-$check raid0
-tst="sh tests/testdev $md2 3 $mdsize1 64"
+mdadm -CR $md2 -l0 --metadata=1.0 -n3 $dev0 $dev1 $dev2
+check raid0
+tst="testdev $md2 3 $mdsize1 64"
$tst
-uuid=`$mdadm -Db $md2 | sed 's/.*UUID=//'`
-$mdadm -S $md2
+uuid=`mdadm -Db $md2 | sed 's/.*UUID=//'`
+mdadm -S $md2
-$mdadm -A $md2 $dev0 $dev1 $dev2
+mdadm -A $md2 $dev0 $dev1 $dev2
$tst
-$mdadm -S $md2
+mdadm -S $md2
-$mdadm -A $md2 -u $uuid $devlist
+mdadm -A $md2 -u $uuid $devlist
$tst
-$mdadm -S $md2
+mdadm -S $md2
# version 1 has now super-minor
-# $mdadm --assemble $md2 --super-minor=2 $devlist #
+# mdadm --assemble $md2 --super-minor=2 $devlist #
# $tst
-# $mdadm -S $md2
+# mdadm -S $md2
conf=$targetdir/mdadm.conf
{
echo array $md2 UUID=$uuid
} > $conf
-$mdadm -As -c $conf $md2
+mdadm -As -c $conf $md2
$tst
-$mdadm -S $md2
+mdadm -S $md2
#{
# echo DEVICE $devlist
# echo array $md2 super-minor=2
#} > $conf
#
-#$mdadm -As -c $conf $md2
+#mdadm -As -c $conf $md2
#$tst
-#$mdadm -S $md2
+#mdadm -S $md2
{
echo array $md2 devices=$dev0,$dev1,$dev2
} > $conf
-$mdadm -As -c $conf $md2
+mdadm -As -c $conf $md2
$tst
echo "DEVICE $devlist" > $conf
-$mdadm -Db $md2 >> $conf
-$mdadm -S $md2
+mdadm -Db $md2 >> $conf
+mdadm -S $md2
-$mdadm --assemble --scan --config=$conf $md2
+mdadm --assemble --scan --config=$conf $md2
$tst
-$mdadm -S $md2
+mdadm -S $md2
echo " metadata=1 devices=$dev0,$dev1,$dev2" >> $conf
-$mdadm --assemble --scan --config=$conf $md2
+mdadm --assemble --scan --config=$conf $md2
$tst
-$mdadm -S $md2
+mdadm -S $md2
# create a raid5 array and assemble it in various ways,
# including with missing devices.
-$mdadm -CR $md1 -l5 -n3 $dev0 $dev1 $dev2
-tst="$check raid5 ;sh tests/testdev $md1 2 $mdsize0 64 ; $mdadm -S $md1"
-uuid=`$mdadm -Db $md1 | sed 's/.*UUID=//'`
-$check wait
+mdadm -CR $md1 -l5 -n3 $dev0 $dev1 $dev2
+tst="check raid5 ;testdev $md1 2 $mdsize0 64 ; mdadm -S $md1"
+uuid=`mdadm -Db $md1 | sed 's/.*UUID=//'`
+check wait
eval $tst
-$mdadm -A $md1 $dev0 $dev1 $dev2
+mdadm -A $md1 $dev0 $dev1 $dev2
eval $tst
-$mdadm -A $md1 -u $uuid $devlist
+mdadm -A $md1 -u $uuid $devlist
eval $tst
-$mdadm -A $md1 -m 1 $devlist
+mdadm -A $md1 -m 1 $devlist
eval $tst
echo array $md1 UUID=$uuid
} > $conf
-$mdadm -As -c $conf $md1
+mdadm -As -c $conf $md1
eval $tst
{
echo array $md1 super-minor=1
} > $conf
-$mdadm -As -c $conf
+mdadm -As -c $conf
eval $tst
{
echo array $md1 devices=$dev0,$dev1,$dev2
} > $conf
-$mdadm -As -c $conf
+mdadm -As -c $conf
echo "DEVICE $devlist" > $conf
-$mdadm -Db $md1 >> $conf
+mdadm -Db $md1 >> $conf
eval $tst
-$mdadm --assemble --scan --config=$conf $md1
+mdadm --assemble --scan --config=$conf $md1
eval $tst
echo " metadata=0.90 devices=$dev0,$dev1,$dev2" >> $conf
-$mdadm --assemble --scan --config=$conf $md1
+mdadm --assemble --scan --config=$conf $md1
eval $tst
### Now with a missing device
-$mdadm -AR $md1 $dev0 $dev2 #
-$check state U_U
+mdadm -AR $md1 $dev0 $dev2 #
+check state U_U
eval $tst
-$mdadm -A $md1 -u $uuid $devlist
-$check state U_U
+mdadm -A $md1 -u $uuid $devlist
+check state U_U
eval $tst
-$mdadm -A $md1 -m 1 $devlist
-$check state U_U
+mdadm -A $md1 -m 1 $devlist
+check state U_U
eval $tst
echo array $md1 UUID=$uuid
} > $conf
-$mdadm -As -c $conf $md1
-$check state U_U
+mdadm -As -c $conf $md1
+check state U_U
eval $tst
{
echo array $md1 super-minor=1
} > $conf
-$mdadm -As -c $conf
-$check state U_U
+mdadm -As -c $conf
+check state U_U
eval $tst
{
echo array $md1 devices=$dev0,$dev1,$dev2
} > $conf
-$mdadm -As -c $conf
+mdadm -As -c $conf
echo "DEVICE $devlist" > $conf
-$mdadm -Db $md1 >> $conf
-$check state U_U
+mdadm -Db $md1 >> $conf
+check state U_U
eval $tst
-$mdadm --assemble --scan --config=$conf $md1
-$check state U_U
+mdadm --assemble --scan --config=$conf $md1
+check state U_U
eval $tst
echo " metadata=0.90 devices=$dev0,$dev1,$dev2" >> $conf
-$mdadm --assemble --scan --config=$conf $md1
-$check state U_U
+mdadm --assemble --scan --config=$conf $md1
+check state U_U
eval $tst
set -e
# create a raid0, re-assemble with a different super-minor
-$mdadm -CR $md0 -l0 -n3 $dev0 $dev1 $dev2
-sh tests/testdev $md0 3 $mdsize0 64
-minor1=`$mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
-$mdadm -S /dev/md0
+mdadm -CR $md0 -l0 -n3 $dev0 $dev1 $dev2
+testdev $md0 3 $mdsize0 64
+minor1=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
+mdadm -S /dev/md0
-$mdadm -A $md1 $dev0 $dev1 $dev2
-minor2=`$mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
-$mdadm -S /dev/md1
+mdadm -A $md1 $dev0 $dev1 $dev2
+minor2=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
+mdadm -S /dev/md1
-$mdadm -A $md1 --update=super-minor $dev0 $dev1 $dev2
-minor3=`$mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
-$mdadm -S /dev/md1
+mdadm -A $md1 --update=super-minor $dev0 $dev1 $dev2
+minor3=`mdadm -E $dev0 | sed -n -e 's/.*Preferred Minor : //p'`
+mdadm -S /dev/md1
case "$minor1 $minor2 $minor3" in
"0 0 1" ) ;;
# create a raid1 array, let it sync, then re-assemble with a force-sync
-$mdadm -CR $md0 -l1 -n2 $dev0 $dev1
-$check wait
-$mdadm -S $md0
+mdadm -CR $md0 -l1 -n2 $dev0 $dev1
+check wait
+mdadm -S $md0
-$mdadm -A $md0 $dev0 $dev1
-$check nosync
-$mdadm -S $md0
+mdadm -A $md0 $dev0 $dev1
+check nosync
+mdadm -S $md0
-$mdadm -A $md0 -U resync $dev0 $dev1
-$check resync
-$mdadm -S $md0
+mdadm -A $md0 -U resync $dev0 $dev1
+check resync
+mdadm -S $md0
#
bmf=$targetdir/bitmap
rm -f $bmf
-$mdadm --create --run $md0 --level=1 -n2 --delay=1 --bitmap $bmf $dev1 $dev2
-$check wait
-sh tests/testdev $md0 1 $mdsize0 1
-$mdadm -S $md0
-
-$mdadm --assemble $md0 --bitmap=$bmf $dev1 $dev2
-sh tests/testdev $md0 1 $mdsize0 1
-dirty1=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+mdadm --create --run $md0 --level=1 -n2 --delay=1 --bitmap $bmf $dev1 $dev2
+check wait
+testdev $md0 1 $mdsize0 1
+mdadm -S $md0
+
+mdadm --assemble $md0 --bitmap=$bmf $dev1 $dev2
+testdev $md0 1 $mdsize0 1
+dirty1=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
-dirty2=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty2=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ]
then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2"
exit 1
fi
-$mdadm $md0 -f $dev1
-sh tests/testdev $md0 1 $mdsize0 1
+mdadm $md0 -f $dev1
+testdev $md0 1 $mdsize0 1
sleep 4
-dirty3=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty3=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty3 -lt 400 ]
then
echo >&2 "ERROR dirty count $dirty3 is too small"
exit 2
fi
-$mdadm -S $md0
+mdadm -S $md0
-$mdadm --assemble -R $md0 --bitmap=$bmf $dev2
-$mdadm $md0 --add $dev1
-$check recovery
+mdadm --assemble -R $md0 --bitmap=$bmf $dev2
+mdadm $md0 --add $dev1
+check recovery
-dirty4=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
-$check wait
+dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+check wait
sleep 4
-dirty5=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty5=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ]
then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5"
exit 1
fi
-$mdadm -S $md0
+mdadm -S $md0
#
# create a raid1 array, add an external bitmap
#
-$mdadm --create --run $md0 -l 1 -n 2 $dev1 $dev2
-$check wait
-sh tests/testdev $md0 1 $mdsize0 1
+mdadm --create --run $md0 -l 1 -n 2 $dev1 $dev2
+check wait
+testdev $md0 1 $mdsize0 1
bmf=$targetdir/bm
rm -f $bmf
-$mdadm -E $dev1
-$mdadm --grow $md0 --bitmap=$bmf --delay=1 || { $mdadm -X $bmf ; exit 1; }
-dirty1=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+mdadm -E $dev1
+mdadm --grow $md0 --bitmap=$bmf --delay=1 || { $mdadm -X $bmf ; exit 1; }
+dirty1=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
-dirty2=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty2=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
-sh tests/testdev $md0 1 $mdsize0 1
-dirty3=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+testdev $md0 1 $mdsize0 1
+dirty3=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
-dirty4=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
echo $dirty1 $dirty2 $dirty3 $dirty4
if [ $dirty2 -ne 0 -o $dirty4 -ne 0 -o $dirty3 -lt 400 ]
echo bad dirty counts
exit 1
fi
-$mdadm -S $md0
+mdadm -S $md0
#
# create a raid1 with an internal bitmap
#
-$mdadm --create --run $md0 --level=1 -n2 --delay=1 --bitmap internal $dev1 $dev2
-$check wait
-sh tests/testdev $md0 1 $mdsize0 1
-$mdadm -S $md0
-
-$mdadm --assemble $md0 $dev1 $dev2
-sh tests/testdev $md0 1 $mdsize0 1
-dirty1=`$mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+mdadm --create --run $md0 --level=1 -n2 --delay=1 --bitmap internal $dev1 $dev2
+check wait
+testdev $md0 1 $mdsize0 1
+mdadm -S $md0
+
+mdadm --assemble $md0 $dev1 $dev2
+testdev $md0 1 $mdsize0 1
+dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
-dirty2=`$mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ]
then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2"
exit 1
fi
-$mdadm $md0 -f $dev1
-sh tests/testdev $md0 1 $mdsize0 1
+mdadm $md0 -f $dev1
+testdev $md0 1 $mdsize0 1
sleep 4
-dirty3=`$mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty3 -lt 400 ]
then
echo >&2 "ERROR dirty count $dirty3 is too small"
exit 2
fi
-$mdadm -S $md0
+mdadm -S $md0
-$mdadm --assemble -R $md0 $dev2
-$mdadm $md0 --add $dev1
-$check recovery
+mdadm --assemble -R $md0 $dev2
+mdadm $md0 --add $dev1
+check recovery
-dirty4=`$mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
-$check wait
+dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+check wait
sleep 4
-dirty5=`$mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty5=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ]
then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5"
exit 1
fi
-$mdadm -S $md0
+mdadm -S $md0
#
bmf=$targetdir/bitmap
rm -f $bmf
-$mdadm --create --run $md0 --level=1 -n3 --delay=1 --bitmap $bmf $dev1 $dev2 $dev3
-$check wait
-sh tests/testdev $md0 1 $mdsize0 1
-$mdadm -S $md0
-
-$mdadm --assemble $md0 --bitmap=$bmf $dev1 $dev2 $dev3
-sh tests/testdev $md0 1 $mdsize0 1
-dirty1=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+mdadm --create --run $md0 --level=1 -n3 --delay=1 --bitmap $bmf $dev1 $dev2 $dev3
+check wait
+testdev $md0 1 $mdsize0 1
+mdadm -S $md0
+
+mdadm --assemble $md0 --bitmap=$bmf $dev1 $dev2 $dev3
+testdev $md0 1 $mdsize0 1
+dirty1=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
-dirty2=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty2=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ]
then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2"
exit 1
fi
-$mdadm $md0 -f $dev2
-sh tests/testdev $md0 1 $mdsize0 1
+mdadm $md0 -f $dev2
+testdev $md0 1 $mdsize0 1
sleep 4
-dirty3=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty3=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty3 -lt 400 ]
then
echo >&2 "ERROR dirty count $dirty3 is too small"
exit 2
fi
-$mdadm -S $md0
+mdadm -S $md0
-$mdadm --assemble -R $md0 --bitmap=$bmf $dev1 $dev3
-$check nosync
-$mdadm $md0 --add $dev2
-$check recovery
+mdadm --assemble -R $md0 --bitmap=$bmf $dev1 $dev3
+check nosync
+mdadm $md0 --add $dev2
+check recovery
-dirty4=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
-$check wait
+dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+check wait
sleep 4
-dirty5=`$mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
+dirty5=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ]
then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5"
exit 1
fi
-$mdadm -S $md0
+mdadm -S $md0
exit 0
# create an array with a name
-$mdadm -CR $md0 -l0 -n2 --metadata=1 --name="Fred" $dev0 $dev1
-$mdadm -E $dev0 | grep 'Name : Fred$' > /dev/null || exit 1
-$mdadm -D $md0 | grep 'Name : Fred$' > /dev/null || exit 1
-$mdadm -S $md0
-
-$mdadm -A $md0 --name="Fred" $devlist
-$mdadm -Db $md0
-$mdadm -S $md0
+mdadm -CR $md0 -l0 -n2 --metadata=1 --name="Fred" $dev0 $dev1
+mdadm -E $dev0 | grep 'Name : Fred$' > /dev/null || exit 1
+mdadm -D $md0 | grep 'Name : Fred$' > /dev/null || exit 1
+mdadm -S $md0
+
+mdadm -A $md0 --name="Fred" $devlist
+mdadm -Db $md0
+mdadm -S $md0
# make a raid5 array, byte swap the superblocks, then assemble...
-$mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3
+mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3
sleep 4
-$mdadm -S $md0
+mdadm -S $md0
-$mdadm -E --metadata=0 $dev1 | grep -v Events > $targetdir/d1
+mdadm -E --metadata=0 $dev1 | grep -v Events > $targetdir/d1
for d in $dev0 $dev1 $dev2 $dev3
do $dir/swap_super $d
done
-$mdadm -E --metadata=0.swap $dev1 | grep -v Events > $targetdir/d1s
+mdadm -E --metadata=0.swap $dev1 | grep -v Events > $targetdir/d1s
diff -u $targetdir/d1 $targetdir/d1s
-$mdadm --assemble --update=byteorder $md0 $dev0 $dev1 $dev2 $dev3
+mdadm --assemble --update=byteorder $md0 $dev0 $dev1 $dev2 $dev3
sleep 3
cat /proc/mdstat
-$mdadm -S $md0
+mdadm -S $md0
# create a raid1 array with a wrmostly device
-$mdadm -CR $md0 -l1 -n3 $dev0 $dev1 --write-mostly $dev2
-sh tests/testdev $md0 1 $mdsize0 64
+mdadm -CR $md0 -l1 -n3 $dev0 $dev1 --write-mostly $dev2
+testdev $md0 1 $mdsize0 64
# unfortunately, we cannot measure if any read requests are going to $dev2
-$mdadm -S $md0
+mdadm -S $md0
-$mdadm -CR $md0 -l1 -n3 --write-behind --bitmap=internal $dev0 $dev1 --write-mostly $dev2
-sh tests/testdev $md0 1 $mdsize0 64
-$mdadm -S $md0
+mdadm -CR $md0 -l1 -n3 --write-behind --bitmap=internal $dev0 $dev1 --write-mostly $dev2
+testdev $md0 1 $mdsize0 64
+mdadm -S $md0
cnt=$2
size=$3
chunk=$4
-mkfs -j $dev > /dev/null 2>&1 && fsck -fn $dev
+mkfs -j $dev > /dev/null 2>&1 && fsck -fn $dev >&2
dsize=$[size/chunk]
dsize=$[dsize*chunk]
rasize=$[dsize*1024*cnt]