How to mdadm Grow RAID5

RAID level 5

RAID level 5

Over the last few months I have taken kind of a break from learning and writing but today I bring to you information on mdadm RAID5 array and growing the array onto another drive.

For the past several months I have been slowly but surely filling up the 4 320gig hard drives I have giving me 880gigs of storage. When one day I went to create a backup image of my desktop and realized that I was running low on space. Of the 880gigs I had at the time I was using everything but about 80gigs of space. To fill all that space took me just under a year, my thinking at the time said “there is no way that I can use up almost a terabyte”. Well I was totally wrong.


Before you start you might want to create a backup of all your files but will be unnecessary if everything goes according to plan. You have been warned.

For the steps detailed below I used Fedora 11 I386

  1. After installing the new hard drive of the correct size boot up the computer.
  2. Once the computer has booted and you are logged in drop down to a single user mode by typing the following at the terminal prompt. init 1
  3. Before going any further I recommend dismounting the volume to prevent any data loss by issuing. umount /dev/md0
  4. Now that you are at single user mode you will have to add the disk to the existing array as a spare by issuing the following command.
    mdadm --add /dev/md0 /dev/sd#Where # is the drive that you have just installed. If you do not know which it is you can use fdisk /dev/sd# where # is the letter of the drive you want to check use p to print the partitions and q to quit.
  5. Once the drive has been added as a spare run the following command to grow the RAID array. Note that this will take considerable time to recalculate took my computer about 8 hours.mdadm --grow /dev/md0 --raid-devices=5 If you have less than 5 drives change that number to however many you will have with the addition of the new drive. By running this command you can check the progress.cat /proc/mdstat
  6. Wile waiting for the md0 to rebuild use vim or vi to edit the mdadm.conf file to from num-devices=4 to say num-devices=5.vim /etc/mdadm.conf
  7. Once the rebuild is complete run this command to check the filesystem. fsck.ext3 /dev/md0
  8. Once the filesystem check completes run this command to expand the usable space. resize2fs /dev/md0
  9. Go ahead and reboot you should now be completely done.

Now that wasn’t too bad was it. I personally had success doing it this way although the first time no one said in the guide to edit the mdadm.conf file so I had some problems there. The solution was to use a LiveUSB of Fedora 11 and change that one number from 4 to 5 and everything worked as it should again.

Good luck to you all out there and enjoy your newly expanded RAID5 arrays.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Facebook
  • Google Bookmarks
  • NewsVine
  • RSS
  • Twitter

0 Responses to “How to mdadm Grow RAID5”


  • No Comments
Leave A Comment
  1. (required)
  2. (valid email required)
  3. (required)
  4. Send
 

cforms contact form by delicious:days