If a RAID is running out of space, additional disks can be added to the RAID to grow the array.
NOTE: The drive needs to be the same size as all the others of course.
mdadm --detail /dev/md0
returns:
/dev/md0: Version : 1.2 Creation Time : Tue Sep 6 18:31:41 2011 Raid Level : raid6 Array Size : 3144192 (3.00 GiB 3.22 GB) Used Dev Size : 1048064 (1023.67 MiB 1073.22 MB) Raid Devices : 5 Total Devices : 5 Persistence : Superblock is persistent Update Time : Thu Sep 8 18:54:26 2011 State : clean Active Devices : 5 Working Devices : 5 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : raidtest.loc:0 (local to host raidtest.loc) UUID : e0748cf9:be2ca997:0bc183a6:ba2c9ebf Events : 2058 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 8 32 1 active sync /dev/sdc 5 8 48 2 active sync /dev/sdd 4 8 64 3 active sync /dev/sde 6 8 80 4 active sync /dev/sdf
mdadm --add /dev/md0 /dev/sdg /dev/sdh
returns:
mdadm: added /dev/sdg mdadm: added /dev/sdh
NOTE: In this example 2 drives are added to the RAID.
mdadm --grow /dev/md0 --raid-devices=7
returns:
mdadm: Need to backup 7680K of critical section..
A RAID device is like a hard drive.
resize2fs /dev/md0
returns:
resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/md0 is mounted on /mnt/md0; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/md0 to 1310080 (4k) blocks. The filesystem on /dev/md0 is now 1310080 blocks long.
df -hl
returns:
Filesystem Size Used Avail Use% Mounted on ... /dev/md0 5.0G 70M 4.7G 2% /mnt/md0
mdadm --detail /dev/md0
returns:
/dev/md0: Version : 1.2 Creation Time : Tue Sep 6 18:31:41 2011 Raid Level : raid6 Array Size : 5240320 (5.00 GiB 5.37 GB) Used Dev Size : 1048064 (1023.67 MiB 1073.22 MB) Raid Devices : 7 Total Devices : 7 Persistence : Superblock is persistent Update Time : Thu Sep 8 19:01:15 2011 State : clean Active Devices : 7 Working Devices : 7 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : raidtest.loc:0 (local to host raidtest.loc) UUID : e0748cf9:be2ca997:0bc183a6:ba2c9ebf Events : 2089 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 8 32 1 active sync /dev/sdc 5 8 48 2 active sync /dev/sdd 4 8 64 3 active sync /dev/sde 6 8 80 4 active sync /dev/sdf 8 8 112 5 active sync /dev/sdh 7 8 96 6 active sync /dev/sdg
NOTE: The RAID size has been increased, without ever bringing the file system offline.