[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-raid
Subject:    Grow array size issue if not using full space at first place with super 1.0
From:       Fisher <fisherthepooh () protonmail ! com>
Date:       2018-03-27 10:33:29
Message-ID: sW4DXzaQoS1fk9DMLBYclAtUCxsGakpwG497A3uH8Yb3-1aqemxwUaHZ9z7Uv7BN7BIWvnd5Aav2wh4zb1gSWawKSp2x8jN9FzlKEnXJdGw= () protonmail ! com
[Download RAW message or body]

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

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.

I know setting size sysfs attribute is to inform kernel the size of member
device has changed, but under this circumstance, should mdadm also
have to know the changing size is the device size or just the size user  
want to use on this device?

Thanks,
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic