Upgrading my RAID array

Last weekend I bumped up the storage capacity of my workstation. Given that I had to look up several sources to upgrade (my setup isn’t exactly straightforward) and the fact that one of those sources is now inexplicably unavailable, I figured I should leave myself instructions somewhere for the future.

With the exception of hooking up the new drive, this upgrade didn’t require powering off at all. Such are the joys of a RAID5 array.

My setup is an encrypted software raid5 array on linux, which sits at /dev/md0

  1. Put in the drive and power on.
  2. Figure out what the name of the drive is (mine was /dev/sdd)
  3. Add the new dri9ve to the array as a hot spare via “´╗┐´╗┐mdadm –add /dev/md0 /dev/sdd”
  4. My raid array has a write intent bitmap, which prevents the array from expanding. I temporarily removed it with “mdadm –grow /dev/md0 -b none”
  5. Then I told the array to actually use the new drive. Since I was adding my 5th drive, the command was “mdadm –grow -n 5 /dev/md0”
  6. Waited for 24 hours for data to be migrated. Checked on the progress by using “watch ‘cat /proc/mdstat’
  7. Re-added that bitmap using “mdadm –grow /dev/md0 -b internal”
  8. Told LUKS to resize itself to use the new drive as well using “cryptsetup resize cr_md0”
  9. Once that was done, I had to resize the partition using “resize2fs /dev/mapper/cr_md0”

And done. The array started getting usable freespace immediately, though again it took a few hours to have access to all my new space.

Haven’t had any problems with this setup. However, given a friend’s recent drive failure, I hope to be very thankful of this setup when I finally do have problems.

No comments yet. Be the first.

Leave a reply