How to increase RAID larger than 2TB

Introduction

Before you read this you should first read the rest of this page. The link is a very good read to increase/decrease the size of a RAID array. But it misses some points when you enlarge a RAID beyond 2TB, as I did.

The Journey

My current disks are 2 x 500 GB WD Caviar Black and I wanted to replace them with 4 TB WD Red Pro. I have 4 partitions. They are of about 15 GB, 315 GB and 30 GB.

First I followed the manual, replaced the disc, copied the the filesystem and let it sync.

No Luck.

Then I removed the last partitions and created them again with fdisk.

No luck.

I removed every partition, created all of them again, but I couldn’t enlarge the third partition beyond the original size (315 GB).

The Solution

So I started to use gdisk. I removed all partitions and created them again with gdisk and gave them the RAID filesystem (on Fedora: 29; using fdisk). Still no luck, I couldn’t enlarge it beyond the original size.

I removed everything from the disk and used parted to create a new partition table, like:

parted /dev/sdd mklabel gpt

Than I started to use gdisk to create the partitions (follow the menu):

gdisk /dev/sdd

Gdisk can’t create RAID partitions, so I used fdisk to mark them as RAID (follow the menu):

fdisk /dev/sdd

Replace the second disk and repeat the above.

After that I grew the (last) RAID to the maximum size:

mdadm --grow /dev/md126 -z max

And grew the filesystem:

resize2fs /dev/md126

That’s it!