PDA

View Full Version : Add new hard drive space to software RAID 1



Albertwu
05-10-2016, 05:36 AM
I have a CentOS 6 box running RAID1. It had two 500 GB hard drives, but they were old and slow so I asked my provider to upgrade to new larger ones (1 GB each). The provider did this by shutting down the computer, replacing one drive, letting the RAID sync the discs, and then replacing the other and syncing again.

As a result, the filesystem is still 500 GB, even though the drives are 1 TB each.

What's the best way to make the new space available? Ideally, I would prefer to resize a partition instead of adding one, but I've been told that can be dangerous.

This is what fdisk shows for /dev/sda (/dev/sdb is similar). /dev/sda4 and /dev/sdb4 are new, unused partitions.

/dev/sda1 * 2048 526335 262144 fd Linux raid autodetect
/dev/sda2 526336 8914943 4194304 fd Linux raid autodetect
/dev/sda3 8914944 111314943 51200000 fd Linux raid autodetect
/dev/sda4 111314944 976773167 432729112 5 Extended
/dev/sda5 111316992 119705599 4194304 82 Linux swap / Solaris
/dev/sda6 119707648 976773119 428532736 fd Linux raid autodetect

This is /proc/mdstat:

Personalities : [raid1]
md3 : active raid1 sda6[3] sdb6[2]
428531580 blocks super 1.1 [2/2] [UU]
bitmap: 3/4 pages [12KB], 65536KB chunk

md0 : active raid1 sda1[3] sdb1[2]
262132 blocks super 1.0 [2/2] [UU]

md1 : active raid1 sda2[3] sdb2[2]
4193272 blocks super 1.1 [2/2] [UU]
bitmap: 1/1 pages [4KB], 65536KB chunk

md2 : active raid1 sda3[3] sdb3[2]
51198908 blocks super 1.1 [2/2] [UU]
bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>

This is df:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md2 50394752 27437728 20397080 58% /
tmpfs 4024632 0 4024632 0% /dev/shm
/dev/md0 253859 109038 131715 46% /boot
/dev/md3 421806516 30811880 369568060 8% /home
/dev/md1 4127416 697500 3220256 18% /tmp