Sub topic 10
RAID 1: mirroring for redundancy
This chapter assumes you know what striping, mirroring, and parity mean in general (covered in the RAID building blocks chapter), and that you can tell a drive from a volume. The goal is to understand how RAID 1 works, what it costs, and where it fails.
How RAID 1 works
RAID 1 writes the same data to two drives at the same time. Each drive holds a full copy, called a mirror. If one drive fails, the other keeps serving data with no interruption.
The exam expects these facts:
- Minimum drives: 2. A standard RAID 1 set uses exactly two.
- Fault tolerance: one drive failure.
- Usable capacity: the size of one drive.
- Overhead: 50 percent of the raw space goes to the copy.
Performance
Writes run at about the speed of a single drive, because both drives must finish the write. Reads can be faster, since a controller can serve different requests from each drive. Do not expect the large gains that striping gives you.
Capacity
Two 2 TB drives give 2 TB usable. The usable_capacity function from the capacity chapter does the same calculation.
def raid1_usable(drives, size_tb):
if drives != 2:
raise ValueError("RAID 1 uses exactly two drives")
return size_tb
print(raid1_usable(2, 2)) # 2If the two drives differ in size, the mirror is limited to the smaller one. The extra space on the larger drive goes unused.
Failure and recovery
When a drive fails, the array is degraded. It still works, but it has no redundancy until you repair it. The steps are:
- Identify the failed drive from the controller or the operating system.
- Replace it with a drive of equal or larger size.
- Let the array rebuild. The controller copies all data from the surviving drive to the new one.
A rebuild is a heavy read load on the only good drive. Keep the system's important data backed up before you start.
Common errors
- Assuming the mirror protects against deletion. A deleted or corrupted file is copied to both drives immediately.
- Assuming the capacity is doubled. It is not. You buy two drives and get the space of one.
- Mixing up RAID 1 with RAID 0. RAID 1 copies data for safety. RAID 0 splits data for speed and has no protection.
Typical uses
RAID 1 suits small servers, boot drives, and workstations where uptime matters more than capacity. It is also the building block for RAID 10, which stripes across mirrored pairs.
Exercise
A technician builds a RAID 1 array from two 4 TB drives. One drive fails and is replaced. How much usable space does the array have, and what happens to data on the new drive?
Show answer
The array has 4 TB usable, the size of one drive. The controller rebuilds the array by copying all data from the surviving drive onto the new drive.
Exercise
A user deletes an important file from a RAID 1 volume and asks you to recover it from the second drive. Why will this not work?
Show answer
Mirroring writes every change to both drives, including deletions. The file is gone from both copies, so only a separate backup can restore it.