/dev/md2 has a size of 40GB; I want to shrink it to 30GB. First we have to shrink the file system with resize2fs; to make sure that the file system fits into the 30GB, we make it a little bit smaller (25GB) so we have a little security margin, shrink /dev/md2 to 30GB, and the resize the file system (again with resize2fs) to the max. possible value:

resize2fs /dev/md2 25G

Now we shrink /dev/md2 to 30GB. The --size value must be in KiBytes (30 x 1024 x 1024 = 31457280); make sure it can be divided by 64:

mdadm --grow /dev/md2 --size=31457280

Next we grow the file system to the largest possible value (if you don't specify a size, resize2fs will use the largest possible value)...

resize2fs /dev/md2

... and run a file system check again:

e2fsck -f /dev/md2

Then boot into the normal system again and run the following two commands to add /dev/sda3 back to the array /dev/md2:

mdadm --zero-superblock /dev/sda3
mdadm -a /dev/md2 /dev/sda3

Take a look at

cat /proc/mdstat

and you should see that /dev/sdb3 and /dev/sda3 are now being synced.

3.2 Growing A Degraded Array

Before we boot into the rescue system, we must make sure that /dev/sda3 is really removed from the array: