5

If using a RAID 1 and if there are any inconsistencies between both disks found, data is copied from the primary disk (most likely the one with the lower port number) to the secondary disk.

1) But what if the primary disk is damaged and therefore data differences between both disks exist only due to hardware failures in the primary disk? Will then faulty data be synced to the secondary disk? Are there checksums on modern HDDs to make sure that something like this does not happen?

2) What if I build a RAID 1 from 2 USB-Sticks? Are there any mechanisms on USB-Sticks to detect read problems, so that damaged data won't get synced by the RAID to the other USB-Stick and maybe even overwrite data that is OK? Does a RAID 1 of USB-Sticks (for an embedded system) make sense at all or will they probably fail at around the same time due to the limited write endurance?

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108
stefan.at.wpf
  • 885
  • 3
  • 12
  • 20

1 Answers1

14

You mean if the disk is damaged such that corrupted data is read off it that appears legitimate? That's not a "normal failure". RAID 1 protects against normal failures of a single disk.

It also won't protect you if one disk catches on fire and blows up the other one. These are "abnormal failures". For example, if one disk's write hardware breaks and it doesn't really write data but doesn't report errors, then RAID 1 will fail.

Modern disks have data error detection. So unless there's something like a firmware bug, if data cannot be read accurately, the disk should be able to report it.

An inconsistency between two disks in a functioning RAID 1 array is already a failed condition caused by something outside what the RAID 1 array protects against. For example, it could occur if power is removed. But RAID 1 is not supposed to protect you against power loss. So it doesn't matter if it corrupts data in that case -- it's not supposed to not do that. Whichever disk it copies is fine. It doesn't matter. Neither is more correct than the other.

RAID 1 makes sense if you want to protect against the failure of one device. Write endurance has nothing to do with anything. A RAID 1 array will fail if either device cannot be written to.

RAID is not backup. RAID only gives you the ability to tolerate a specific category of faults. If your fault is not one of those in that specific category, RAID won't help you and can even hurt you.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
  • @stefan, in case you're wondering what RAID level will save you, all the above really applies to any RAID configuration from 1 upwards. – John Gardeniers Aug 15 '12 at 12:57
  • 2
    +1. See also: http://serverfault.com/questions/2888/why-is-raid-not-a-backup – Justin ᚅᚔᚈᚄᚒᚔ Aug 15 '12 at 15:35
  • I had RAID1 on a pair of usb sticks for a boot drive on a home nas. There were some strange errors, I decided to 'fix' the problem when I was tired. Hindsight suggests one of the usb sticks had errors that got the array out of sync, and at a similar time to mdadm dropping the bad stick out of the array, the / partition remounted read only. Then I followed this up with some bad fsck commands and corrupted some more boot info on both sticks. So it was format and re-install time for me. Good thing I had backups of the important bits. USB sticks don't have as robust error handling as HDD or SSD. – BeowulfNode42 Apr 23 '19 at 04:44