5

I have a batch of linux servers using software raid 1 that need to have both disks swapped. While this can be done one disk at a time, I'd like to know if it is possible to do both at once with a process like the following, to reduce the outages needed:

1) connect new drives via USB 2) Add both new drives to the array, rebuilding data to them 3) install grub on new drives 4) shutdown and swap drives

This plan requires the ability to mirror the information in the aray across 4 devices, and a quick test shows that mdadm makes all devices after the first two in a RAID 1 aray spare disks. Is there anyway to override this, or do I need to go with two outages to swap disks over one-by-one?

DrStalker
  • 6,946
  • 24
  • 79
  • 107

2 Answers2

10

Yes, you can grow a RAID-1 set to include as many drives as you like. What you need to do is add the new drives as spares, and then run mdadm /dev/mdX --grow -n 4 (or however many devices you want to have in the set). They'll then be synced to, and you can go play swapsies at your leisure once that's done.

womble
  • 96,255
  • 29
  • 175
  • 230
1

As it has been told, you can - my answer is an extension for this fact.

I usually keep a low-profile root filesystem with low writing rate, then I spread this filesystem across all disks in the system using raid1 (typically 4 or more devices). Basically I make a 512M partition in the beginning of each disk, which serves a part for the raid1 containing the root. In this case, I can lose any disk without risking to boot the system.

You should consider this.

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
asdmin
  • 2,050
  • 17
  • 28