Software Raid5 size smaller than expected

The solution is to offline and resize the RAID partition on each disk. I did that using the following commands:

To offline disk sdb1

mdadm /dev/md127 --fail /dev/sdb1 --remove /dev/sdb1

To resize the partition

parted
(parted) select /dev/sdb
(parted) resizepart
Partition number? 1
End? [4000GB]? 8002GB

Then add back the device to the array

mdadm -a /dev/md127 /dev/sdb1

After this is done for every disk, just resize the array

mdadm --grow /dev/md127 -z max