[CentOS] quick question on RAID 1

Sat Aug 13 23:53:10 UTC 2005
Lamar Owen <lowen at pari.edu>

On Saturday 13 August 2005 07:55, Ulrik S. Kofod wrote:
> I have 3 disks that I want to setup in a raid 1, my questions is should I
> setup the 3rd disk as a spare-disk or should I mirror all 3 disks all the
> time?

I believe you can do either, but setting it up as a spare works ok, too.  Nice 
when one drive of a mirrored RAID1 starts throwing errors to throw the spare 
on, let the sync happen, then hot fail the drive that's throwing errors.  For 
IDE of course you will have to power down to pull the drive; depending upon 
your setup you might have hotswap (SATA can do hotswap, but the software 
support is poor; SCSI can do hotswap as long as it's either SCA or a special 
hotswap carrier (I have three such carriers for 68-pin UW-SCSI that has a bus 
isolator board that allows hotswapping regular UW-SCSI drives)) and then it's 
easy, particularly with some SCSI controllers, where you can stop a device 
and then rescan/start a device on the fly.

I just migrated a single drive LVM setup to a RAID 1 mirror last week.  The 
procedure isn't terribly hard, but it revolved around setting up a 
single-drive RAID 1 (requires the --force switch to mdadm), creating the 
physical volume, volume group(s), and logical volumes, then copying all data 
from the old single drive to the new drive.  Once the copy was verified, I 
simply zeroed the partition table of the old drive, used fdisk to create a 
software raid partition (the entire disk in this case), then used mdadm to 
hotadd the old drive and make it active (mdadm --grow is the part that made 
it active).

For RAID 1 the number of drives is not limited to 2, contrary to common 
belief.  You can have three or more; just understand that a RAID 1 set with 4 
250GB drives (for example) will present itself as a single 250GB RAID (with 
three mirrors) and not as a 500GB RAID (for that, you want RAID 1+0 or a RAID 
1 of LVM volume groups; the RAID layer would see two RAID devices, /dev/md0 
and /dev/md1, for example, and the volume group would span the two RAID 
devices (/dev/md0 and /dev/md1, again), which is a little more robust and 
much more flexible than a classic RAID 1+0).

> Will it perform *much* better to only mirror two and have the 3rd as a
> spare. Is it not safer to mirror all 3 drives all the time ?

The md layer will have to perform three writes instead of two; the drive 
interface technology will impact the performance of a triple write more than 
anything else, with straight IDE taking probably a 33% performance hit 
(having 66% of the writes-per-second of the two-drive RAID), with 
well-designed SCSI setups (multiple host adapter channels) potentially taking 
a small fraction of that hit.
Lamar Owen
Director of Information Technology
Pisgah Astronomical Research Institute
1 PARI Drive
Rosman, NC  28772