Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want replace all disks in a 10 disk raid6 (linux software raid).

I could do this by pulling a disk, let the array rebuild, rinse, repeat.

But this would take a very long time, and cause 10 rebuilds, which would most likely stress all 10 disks much more than simply reading each disk through once.

My question is thus:

Could I just shut down the array, and dd each old disk to a new disk and then start the array with the 10 new disks?

In an ideal world, I would build another server and just copy the data via network, but this is not an ideal world.

share|improve this question
    
RAID-6 has two redundant HDDs, so even if you did it by replacing drives, waiting for the rebuild, and repeating, you could do two at a time so would only need five cycles. –  MadHatter Jun 6 at 0:11
    
@MadHatter But aren't you then assuming that no drives will fail during the rebuilds ? –  DusteD Jun 6 at 0:19
    
Yes, I am. I didn't say I advocated it, I was merely pointing out what seemed like an error in your arithmetic. Whilst I've known people upgrade all 28 discs in a RAID-4 array by failing them out one at a time, and rebuilding 28 times, they didn't much enjoy the experience. How about backing up all the data on the array with your existing backup solution, recreating the array, and restoring the data? –  MadHatter Jun 6 at 0:24

1 Answer 1

up vote 1 down vote accepted

Assuming you're not changing the size of the disks (that is, the new disks must be at least as large as the old ones), it is perfectly valid (and probably the best idea) to use dd to copy each drive. I myself have done this using ddrescue on bad/temperamental drives to fix a failed array. You can dd directly to the new drive, too. Make sure to set bs=1M or something thereabouts to reduce the time it takes to copy.

You'll first want to stop the array, and remove it from your md configuration to prevent it from being automatically re-assembled. Assuming you have space for only 10 drives simultaneously, you can replace 5 at a time. I'd suggest using screen to guard against a terminal disconnect (particularly over SSH), and to allow you to start all 5 commands simultaneously. Let that run, then switch to the other set of 5 old and 5 new and do the same. Put all the new ones back in and reassemble your md array.

share|improve this answer
    
I'm interested by this. How do you reinsert the five recently-cloned HDDs in such a manner that the array does not immediately try to resync them anyway? Also, I don't quite understand the assertion that you can do five at a time; this is a RAID-6 array, so the OP has at most two surplus discs at any given time, surely? –  MadHatter Jun 7 at 13:59
    
If you remove the entry in the md configuration for the array to be cloned, it should prevent it from attempting assembly. If not, one could merely do md --stop /dev/md/blah to stop the half-array. Regardless, if you tell md to disregard the array it will certainly obey. As far as cloning 5 at a time, using dd bypasses the md configuration entirely and copies only the raw data on the drives. Thus, since the OP has space for 10 drives to run simultaneous (at least), he can copy half the array at a time, or 5 drives. This does not depend on RAID redundancy, merely physical space. –  gjsmo Jun 8 at 1:06

Your Answer

 
discard

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.