]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: print useful error when converting RAID1->RAID5 will fail.
authorNeilBrown <neilb@suse.de>
Thu, 22 Mar 2012 06:00:57 +0000 (17:00 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 22 Mar 2012 06:00:57 +0000 (17:00 +1100)
RAID1 can only be converted to RAID0 or RAID5 if the size is
a multiple of 4K as we cannot have chunks smaller than 4K.

If this might happen, report a useful error message.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index a0dbb205bf3d2ee2ced1c1ba3b7c417c8cebb1a9..e3ef8d432270a2f762fc40fd9ff92d3b3a556957 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1023,6 +1023,10 @@ char *analyse_change(struct mdinfo *info, struct reshape *re)
                 * raid5 with 2 disks, or
                 * raid0 with 1 disk
                 */
+               if (info->new_level > 1 &&
+                   (info->component_size & 7))
+                       return "Cannot convert RAID1 of this size - "
+                               "reduce size to multiple of 4K first.";
                if (info->new_level == 0) {
                        if (info->delta_disks != UnSet &&
                            info->delta_disks != 0)