0

I've been running an 8x2TB RAID 6 mdadm array on Debian for several years. Last array check found no errors, but SMART data for a couple of the drives is indicating some bad sectors. I'd like to swap out the drives for good ones before I start losing files. All drive slots are full, but I've ordered a couple of USB3 to SATA adapters so I can hook the old drives up and copy the data to the new ones. With two drives to replace, what would be the best way to go about this? Taking the array offline for the duration of the work is not a problem. I'm assuming that copying the data from old drives to new is better than rebuilding the array.

3
  • copying data w/o involving the raid layer is possible but risky - metadata will not reflect a bad copy, which would introduce bad data into your arrays, so you have to be very extra sure you're doing it correctly. for your specific use case, there is mdadm --replace Commented Oct 4, 2023 at 17:58
  • The Linux RAID wiki recommends using ddrescue. But I wasn't sure it was the best method when multiple drives need replacement. raid.wiki.kernel.org/index.php/Replacing_a_failed_drive Commented Oct 4, 2023 at 19:13
  • the wiki also shows completely wrong commands. don't trust the wiki too much. Commented Oct 4, 2023 at 19:22

1 Answer 1

1

I don't know your setup, but normally RAID 5 & 6 are hot swappable. Meaning you can pull the drive out while it is running. As you you don't know about that, your system probably doesn’t have that setup. The difference between RAID five and RAID 6 is how many parity drives you have. Usually RAID 5 has 1 drive and RAID 6 has 2. This means you can have 2 drives fail without data lose.

So I would follow these steps.

  1. verify that your RAID is RAID 6
  2. backup all your data to a external hard drives.
  3. power down your system.
  4. remove 1 drive
  5. reboot your system. You should get an error. but you should still have access to your files. if not put the drive back in. Your data should be fine as you did a backup.
  6. power down system add new drive. then boot the system.
  7. In the software add the drive to your volume. It may happen automatically, depends on your setup. The other drives will then replace the data missing from your old drive and copy it to the new one. This will take awhile.
  8. repeat the steps for the other drive.

Make sure your replacement drive is the same type s the old one

4
  • 1
    "normally RAID 5 & 6 are hot swappable" - that's entirely dependent on the chassis hardware Commented Oct 4, 2023 at 15:59
  • @roaima I have never worked on a RAID 5 or 6 system where the drives where not hot swappable. The instructions I gave are for non-hot swappable systems. Commented Oct 4, 2023 at 16:12
  • The reason I asked is that before I posted this, I did a decent amount of net searching regarding replacing failed drives in an mdadm array, and pretty much all of the articles I found recommend the copy and replace method, but that was for a single drive. The aim was apparently to reduce stress on the array during a rebuild. While my hardware does support hot swapping, I wasn't sure how the software would handle it. I can unmount the array and make copies of both failing drives simultaneously which I thought might be faster than having the array rebuild itself. Commented Oct 4, 2023 at 17:08
  • @Swechsler My experience as a Linux sys admin, says that if you have hot swappable drives you should replace them one at a time. I have never used mdadm. I am experienced with ZFS and NetApp storage systems. I have a asustor at home. It looks like mdadm is a software RAID. Can you in the software remove the hard drive from the RAID and then add a new into the RAID. As your drives are not at failure and you just have errors you have time. Again I would replace one drive at a time so you have better system performance during the change over. Commented Oct 4, 2023 at 23:58

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.