struct map_ent *map = NULL;
struct stat stb;
if (ioctl(fd, STOP_ARRAY, NULL)) {
- if (quiet==0)
+ if (quiet==0) {
fprintf(stderr, Name ": fail to stop array %s: %s\n",
devname, strerror(errno));
+ if (errno == EBUSY)
+ fprintf(stderr, "Perhaps a running "
+ "process, mounted filesystem "
+ "or active volume group?\n");
+ }
return 1;
}
if (quiet <= 0)
*/
mdu_array_info_t array;
mdu_disk_info_t disc;
+ unsigned long long array_size;
mddev_dev_t dv, next = NULL;
struct stat stb;
int j, jnext = 0;
return 1;
}
+ /* array.size is only 32 bit and may be truncated.
+ * So read from sysfs if possible, and record number of sectors
+ */
+
+ array_size = get_component_size(fd);
+ if (array_size <= 0)
+ array_size = array.size * 2;
+
tst = super_by_fd(fd);
if (!tst) {
fprintf(stderr, Name ": unsupport array - version %d.%d\n",
if (array.not_persistent == 0) {
- /* Make sure device is large enough */
- if (tst->ss->avail_size(tst, ldsize/512) <
- array.size) {
- fprintf(stderr, Name ": %s not large enough to join array\n",
- dv->devname);
- return 1;
- }
-
/* need to find a sample superblock to copy, and
* a spare slot to use
*/
fprintf(stderr, Name ": cannot find valid superblock in this array - HELP\n");
return 1;
}
+
+ /* Make sure device is large enough */
+ if (tst->ss->avail_size(tst, ldsize/512) <
+ array_size) {
+ fprintf(stderr, Name ": %s not large enough to join array\n",
+ dv->devname);
+ return 1;
+ }
+
/* Possibly this device was recently part of the array
* and was temporarily removed, and is now being re-added.
* If so, we can simply re-add it.
/* non-persistent. Must ensure that new drive
* is at least array.size big.
*/
- if (ldsize/512 < array.size) {
+ if (ldsize/512 < array_size) {
fprintf(stderr, Name ": %s not large enough to join array\n",
dv->devname);
return 1;