if (strcmp(st->ss->name, "1.x") == 0 &&
st->minor_version >= 1)
/* metadata at front */
- warn |= check_partitions(fd, dname, 0);
+ warn |= check_partitions(fd, dname, 0, 0);
else if (level == 1 || level == LEVEL_CONTAINER
|| (level == 0 && raiddisks == 1))
/* partitions could be meaningful */
- warn |= check_partitions(fd, dname, freesize*2);
+ warn |= check_partitions(fd, dname, freesize*2, size*2);
else
/* partitions cannot be meaningful */
- warn |= check_partitions(fd, dname, 0);
+ warn |= check_partitions(fd, dname, 0, 0);
if (strcmp(st->ss->name, "1.x") == 0 &&
st->minor_version >= 1 &&
did_default &&
extern int check_ext2(int fd, char *name);
extern int check_reiser(int fd, char *name);
extern int check_raid(int fd, char *name);
-extern int check_partitions(int fd, char *dname, unsigned long long freesize);
+extern int check_partitions(int fd, char *dname,
+ unsigned long long freesize,
+ unsigned long long size);
extern int get_mdp_major(void);
extern int dev_open(char *dev, int flags);
return retval;
}
-int check_partitions(int fd, char *dname, unsigned long long freesize)
+int check_partitions(int fd, char *dname, unsigned long long freesize,
+ unsigned long long size)
{
/*
* Check where the last partition ends
Name ": metadata will over-write last partition on %s.\n",
dname);
return 1;
+ } else if (size && endofpart > size) {
+ /* partitions will be truncated in new device */
+ fprintf(stderr,
+ Name ": array size is too small to cover all partitions on %s.\n",
+ dname);
+ return 1;
}
}
return 0;