In practice, yes. The vast majority of hard drive failures occur all-or nothing.
Either (a) the cable is unplugged or the drive microcontroller have failed, so the RAID controller gets no response at all -- obvious failed drive.
Or (b) The cable and drive microcontroller are good, but when it tries to read a sector, the internal drive microcontroller detects data corruption because the internal ECC checksum failed, and repeated attempts to read that sector (in case it's a temporary read glitch) eventually time out, so the RAID controller gets a polite "sorry" response -- obvious failed drive.
Either way, it is obvious to the RAID-1 or RAID-5 controller that the drive has failed.
In principle, no.
If something has gone so badly wrong that a hard drive is writing nonsense, and yet somehow working well enough to write the correct internal ECC code for that nonsense, then RAID-1 can't tell which drive is correct.
The RAID-1 system will likely overwrite the good data with the corrupt data on a resync.
RAID-5 is no better.
The "RAID-5 write hole" power failure during active writing is one particular rare but not impossible case.
As far as I know, the only way to avoid such corruption is to use end-to-end checksums in addition to file mirroring, either automatically as part of the file system (ZFS or Btrfs) or periodically or manually (recalculating rsync checksums, simple file verification, Parchive file sets, etc.); ideally with a cryptographic hash such as SHA-256.
4+1 "This is why RAID is not a backup" God knows how many times I've heard "I'm ok, got my backup covered with a RAID" – Urda – 2010-02-24T03:13:11.663
2How can the RAID distinguish between which data is good and which is bad? – None – 2010-02-24T04:13:31.597
1Shaun... if your data is eaten by a virus or accidentally deleted, the RAID can never distinguish it as good or bad. All the RAID is in charge of is making sure that (in a RAID 1) that both disks are equal. If a sector fails a checksum, the RAID controller compensates to repair it, or triggers a rebuild. In a RAID 5, if a sector fails a parity check, a rebuild is triggered. RAID protects the physical drives from failing, and resulting from data loss. They cannot protect against data lost to program faults or viruses. – Urda – 2010-02-24T14:47:17.420
2I have to downvote this. RAID1 does not do checksumming, it only protects against a complete drive failure. If one drive starts returning garbage, it has no way to tell which one is right, and will happily return garbage data. RAID5 I'm not sure of, because of the parity checks. This is exactly why filesystems like ZFS and BTRFS were invented, so that you get a 'data-aware' RAID-like system, which can correct garbage data appropriately using checksums to verify blocks of data. – Alex – 2015-08-27T11:45:00.933
6Your characterization of RAID 5 is inaccurate. There is no separate parity drive, instead parity is distributed across all drives. You end up with a total available space of n-1, but there isn't a drive dedicated to parity. – MDMarra – 2010-06-04T03:38:57.630
1@Urda, there is no checksum to be checked on RAID 1, correct? In that case, if the RAID system detects that a block contains different data in each disk, wouldn't it have to guess which ones is right, possibly risking causing filesystem level corruption during the rebuild? – Renan – 2013-04-26T06:32:12.920