Unexpected difference between a 4-disk RAID5 and a 3-disk RAID5 reshaped into a 4-disk RAID5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am seeing some unexpected (to me, anyway) behavior after reshaping an array.  This is with kernel 3.10.0-862.9.1.el7.x86_64 (Centos 7.5.1804) with mdadm-4.0-13.el7.x86_64.  All of the disks I'm discussing here are are exactly 5GiB in size (I'm testing on a VM).

Basically, if I create a 4-disk RAID5 with those disks, I get a component size of 5237760 and an overall array size of 16090398720.  If I try and grow --size=max on that array, it (reasonably) has no effect.

If I create a 3-disk RAID5 with those disks and then add a 4th disk, after the reshape completes, I again have a component size of 5237760, and overall array size of 16090398720, matching that of the original 4-disk RAID5  But, now, if I try and grow --size=max on that array, it *does* have an effect, and the overall array size goes up by 4.5 MiB.

My question is why did the --grow manage to increase the component size in the 3+1 case?  Shouldn't it have already been set as high as it could go after the reshape?

Here's the details:

	Create a RAID 5 over 4 devices:

	# mdadm --create /dev/md2 --level 5 --raid-devices 4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
	mdadm: Defaulting to version 1.2 metadata
	mdadm: array /dev/md2 started.

	The component size is for this array is:

	# cat /sys/block/md2/md/component_size 
	5237760

	Trying to grow it further has no effect:

	# mdadm --grow /dev/md2 --size=max
	mdadm: component size of /dev/md2 unchanged at 5237760K

	The overall size of the array is:

	# blockdev --getsize64 /dev/md2
	16090398720

Now the 3-disk+1 case:

	Create a 3-disk RAID5:

	# mdadm --create /dev/md2 --level 5 --raid-devices 3 /dev/sdb /dev/sdc /dev/sdd
	mdadm: Defaulting to version 1.2 metadata
	mdadm: array /dev/md2 started.

	The component size:

	# cat /sys/block/md2/md/component_size 
	5237760

	And like before, trying to grow it further has no effect:

	# mdadm --grow /dev/md2 --size=max
	mdadm: component size of /dev/md2 unchanged at 5237760K

	Now, I add another disk to the array:

	# mdadm --grow /dev/md2 --raid-devices 4 --add /dev/sde
	mdadm: added /dev/sde

	The component size is, as expected, unchanged:

	# cat /sys/block/md2/md/component_size 
	5237760

	The overall size of the newly 4-disk array now matches that of the array created with 4 disks from the start:

	# blockdev --getsize64 /dev/md2
	16090398720

So everything is as expected thus far.  The component and overall size of the 4-disk array and the 3-disk array reshaped into a 4-disk array match exactly.

Now the unexpected bit.  I try and resize this new 3-disk-resized-to-4-disk array, and unlike the original 4-disk array, this one *grows*:

	# mdadm --grow /dev/md2 --size=max
	mdadm: component size of /dev/md2 has been set to 5239296K

	The component size went up by 1536K.

	# blockdev --getsize64 /dev/md2
	16095117312

	The overall array size went up by 4.5 MiB (because 3 * 1536 ?)

Any light anyone can shed on this would be very appreciated!

David



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux