Adding a hot spare to an mdraid array

I found a spare 160GB SATA drive while cleaning today. Since I had a spare slot in the hotswap canister I keep my RAID-5 data array in, I threw it in there. I decided to build it out as a hot spare rather than restripe the array since I didn’t need the extra space and having a spare is always nice. Here’s the procedure:

Disk /dev/sdg: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1       19457   156288321   fd  Linux raid autodetect

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
green (kitesfear) $ cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid1 sdb1[1] sda1[0]
      264960 blocks [2/2] [UU]

md2 : active raid1 sdb6[1] sda5[0]
      97297536 blocks [2/2] [UU]

md3 : active raid1 sdb7[1] sda3[0]
      41945600 blocks [2/2] [UU]

md4 : active raid5 sdc1[0] sdd1[1] sde1[2]
      312576512 blocks level 5, 256k chunk, algorithm 2 [3/3] [UUU]

md1 : active raid1 sdb2[1] sda2[0]
      16779776 blocks [2/2] [UU]

unused devices: 
green (kitesfear) $ sudo /sbin/mdadm --add /dev/md4 /dev/sdg1
mdadm: added /dev/sdg1
green (kitesfear) $ cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid1 sdb1[1] sda1[0]
      264960 blocks [2/2] [UU]

md2 : active raid1 sdb6[1] sda5[0]
      97297536 blocks [2/2] [UU]

md3 : active raid1 sdb7[1] sda3[0]
      41945600 blocks [2/2] [UU]

md4 : active raid5 sdg1[3](S) sdc1[0] sdd1[1] sde1[2]
      312576512 blocks level 5, 256k chunk, algorithm 2 [3/3] [UUU]

md1 : active raid1 sdb2[1] sda2[0]
      16779776 blocks [2/2] [UU]

unused devices: 
Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: