Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a production raid array that has hit problems. Luckily when I configured it I assigned a hot spare. Here is what the status looks like now:

mdadm --detail /dev/md2
        Version : 0.90
  Creation Time : Sun Jul  4 14:49:33 2010
     Raid Level : raid5
     Array Size : 3907039744 (3726.04 GiB 4000.81 GB)
  Used Dev Size : 976759936 (931.51 GiB 1000.20 GB)
   Raid Devices : 5
  Total Devices : 6
Preferred Minor : 2
    Persistence : Superblock is persistent

    Update Time : Sun Aug  5 11:56:50 2012
          State : active, degraded, recovering
 Active Devices : 4
Working Devices : 5
 Failed Devices : 1
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 64K

 Rebuild Status : 63% complete

           UUID : dce41d37:804dea59:e5727503:733c194b
         Events : 0.13139

    Number   Major   Minor   RaidDevice State
       0       8      145        0      active sync   /dev/sdj1
       1       8      161        1      active sync   /dev/sdk1
       2       8      177        2      active sync   /dev/sdl1
       3       8      193        3      active sync   /dev/sdm1
       5       8      225        4      spare rebuilding   /dev/sdo1

       6       8      209        -      faulty spare   /dev/sdn1

If and when this completes however what do I need to do to replace the faulty drive as a new spare? Ideally I don't want to have to take the system down next week.

share|improve this question

If your system supports hot-swap (sata, sas, ...) then you can do:

mdadm /dev/md2 --remove /dev/sdn1

To remove the disk from the raid array md2. Later on when you have connected the new disk and partitioned it you can do:

mdadm /dev/md2 --add /dev/sdx1 

To add it to the raid.

share|improve this answer
When I add the disk back would it be safe to assume that it would be --add /dev/sdn1 ? I'm guessing sfdisk -d will work to set up the drive with the correct partitions ? Can this all be done with the raid started? – user131012 Aug 5 '12 at 12:53
@user131012 depending on your controller driver, the drive may or may not be "n". You may have to force a rescan after pulling the drive and/or after inserting the new drive:… – DerfK Aug 5 '12 at 16:00
as DerfK said you can't be sure it will be named sdn1, but as long as you find it for the first time(by looking at dmesg or fdisk -l) it won't matter because the next time/boot mdadm will find it by it's id that it's written when you add it to the array for the first time. You can do it while the array is started. – Jure1873 Aug 5 '12 at 16:54

Whether you need to take the server down depends purely on the OS and hardware host-swap features. If hot-swap is supported in the whole stack, it should be possible to take out the disk with the server running.

On the other hand, the hot spare in the raid array just gave you time to plan scheduled downtime if such is needed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.