>>>>> "Jes" == Jes Sorensen <jes.sorensen@xxxxxxxxx> writes: Jes> On 10/04/2017 02:00 PM, John Stoffel wrote: >> >> Since Eli had such a horrible experience where he shrunk the >> individual component raid device size, instead of growing the overall >> raid by adding a device, I came up with this hacky patch to warn you >> when you are about to shoot yourself in the foot. >> >> The idea is it will warn you and exit unless you pass in the --force >> (or -f) switch when using the command. For example, on a set of loop >> devices: >> >> # cat /proc/mdstat >> Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] >> [raid4] [multipath] [faulty] >> md99 : active raid6 loop4p1[4] loop3p1[3] loop2p1[2] loop1p1[1] >> loop0p1[0] >> 606720 blocks super 1.2 level 6, 512k chunk, algorithm 2 [5/5] >> [UUUUU] >> >> # ./mdadm --grow /dev/md99 --size 128 >> mdadm: Cannot set device size smaller than current component_size of /dev/md99 array. Use -f to force change. >> >> # ./mdadm --grow /dev/md99 --size 128 -f >> mdadm: component size of /dev/md99 has been set to 0K >> >> >> I suspect I could do a better job of showing the original component >> size, so that you have a chance of recovering even then. >> >> But the patch: Jes> Before looking at the actual code, some cosmetics Sure, I'll re-spin the patch, I have my emacs setup to use 4 spaces for indentation, not 8 space tabs. >> @@ -1617,7 +1617,7 @@ int main(int argc, char *argv[]) >> else if (s.size > 0 || s.raiddisks || s.layout_str || >> s.chunk != 0 || s.level != UnSet || >> data_offset != INVALID_SECTORS) { >> - rv = Grow_reshape(devlist->devname, mdfd, >> + rv = Grow_reshape(devlist->devname, mdfd, c.force, Jes> Yikes! Can you explain please? I added in the c.force since that's the value set by the -f (--force) flag when you call mdadm from the command line. -- 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