On 03/29/2018 09:45 AM, Fisher wrote:
Hi, I have a raid1 array composed with 2 disks which has 931GB size At first, I created this array with --size=5G and --metadata=1.0 set after that I grew the array to --size=10G and it succeed. Then I grew the array again to --size=20G but it failed this time with the following message mdadm: Cannot set device size for /dev/md0: No space left on device after I traced the code, I found it was because the following code int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, /* skip */ for (mdi = sra->devs; mdi; mdi = mdi->next) { sysfs_set_num(sra, mdi, "size", s->size == MAX_SIZE ? 0 : s->size); this changed the value of rdev->size from 1933615488 to 20971520 at first grow but second grow was limited by kernel when mdadm tried to set 41943040 to size
20971520 and 41943040 can match 10G and 20G well, but how 1933615488 could represent 5G capacity?
static unsigned long long super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors) /* skip */ max_sectors = rdev->sectors + sb_start - rdev->sb_start; ^^^^^^^^^^^^^ 20971520 if (!num_sectors || num_sectors > max_sectors) num_sectors = max_sectors; seems like there's no way this array can be grown again.
Which kernel version are you used? I can't reproduce it with 4.16.0-rc1. Thanks, Guoqing -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html