Increasing Linux RAID 1 array HDD Sizes
Here is a procedure I developed to upgrade the disks in a Linux RAID 1 (mirror) array, and hence increase the size of the RAID volume.
Fail the partition on one of the old array disks:
1 2 |
# mdadm --manage /dev/md0 --fail /dev/sdc1 mdadm: set /dev/sdc1 faulty in /dev/md0 |
Remove partition on old disk from array
1 2 |
# mdadm --manage /dev/md0 --remove /dev/sdc1 mdadm: hot removed /dev/sdc1 |
Confirm removal
1 2 3 4 5 6 |
# cat /proc/mdstat Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 sdb1[0] 1953514432 blocks [2/1] [U_] unused devices: |
Power down server, replace drive, restart server.
Partition new drive to full capacity, set patition type to FD00 ‘Linux RAID’
1 2 3 4 5 6 7 8 9 10 |
# gdisk /dev/sdc Disk /dev/sdc: 7814037168 sectors, 3.6 TiB Disk identifier (GUID): 3A886045-133C-0A52-C8D4-2675BFCC1D17 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 7814037134 Total free space is 0 sectors (0 bytes) Number Start (sector) End (sector) Size Code Name 1 34 7814037134 3.6 TiB FD00 Linux RAID |
Add new partition to array
1 2 |
# mdadm --manage /dev/md0 --add /dev/sdc1 mdadm: added /dev/sdc1 |
Confirm syncing underway
1 2 3 4 5 6 7 |
# cat /proc/mdstat Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 sdc1[2] sdb1[0] 1953514432 blocks [2/1] [U_] [>....................] recovery = 0.0% (1131840/1953514432) finish=316.2min speed=102894K/sec unused devices: |
Once syncing complete
1 2 3 4 |
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 sdb1[0] sdc1[1] 1953514432 blocks [2/2] [UU] unused devices: |
Repeat for /dev/sdb1 and /dev/sdb
When second drive syncing complete . . .
Unmount RAID file system
1 |
# umount /dev/md0 |
Check RAID file system
1 2 3 4 5 6 7 8 |
# e2fsck -f /dev/md0 e2fsck 1.41.11 (14-Mar-2010) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/md0: 5550068/122101760 files (3.7% non-contiguous), 450886478/488378608 blocks |
Grow array
1 |
# mdadm --grow /dev/md0 --size=max |
Resize file system
1 2 3 4 |
# resize2fs /dev/md0 resize2fs 1.41.11 (14-Mar-2010) Resizing the filesystem on /dev/md0 to 976754608 (4k) blocks. The filesystem on /dev/md0 is now 976754608 blocks long. |
Check RAID file system
1 |
# e2fsck -f /dev/md0 |
Remount RAID file system
1 |
# mount /dev/md0 /var/samba |
Done!