Striping and parity across three drives, oh my!
Of all the RAID levels that consumers are likely to use on their home systems, RAID 5 is one of the more exotic choices. While RAID 0 and 1 are pretty straightforward, RAID 5 is a little more complex.
As we discussed in earlier articles, RAID 0 stripes data across an array of drives , making reads and writes faster, while also sacrificing redundancy. RAID 1 does the opposite , writing identical data across every drive in the array, creating a redundancy in the event of failure. RAID 5 is somewhere in between.
Like RAID 0, RAID 5 stripes data across an array of drives. However, one of the drives is reserved as the redundant copy of the piece of data. As each block of data is written, the stripes and redundant copy rotate places, so that no single drive fills up with redundant copies (this is called distributed parity). For this to work, RAID 5 requires a minimum of three drives.
When a drive in a RAID 5 array fails, the data can be located somewhere else in the array. If failure occurred on a drive that held a striped copy, the entirety of the data can be found on the drive that holds the parity copy. If the parity is missing, you still have a copy of the data striped across the other drives. On the flip side, if you lose more than one drive, you’ll lose the entire array because parity is distributed across all the drives.
In terms of performance, read operations will be similar to that of RAID 0, as the striped data can be read from several drives at one. Write operations, however, are more like RAID 1, since the parity data is written to only one drive.
Drive space is also pooled, but less so than in RAID 0. In RAID 5, it works a bit differently. Due to the way parity works, if you have three drives, the available space will be equal to a RAID 0 array with two drives. In our examples, we used three 120GB SSDs, which resulted in arrays with 240GB of space.
If you want install an OS on top of a RAID array, RAID 5 will work fairly well, so long as you’re not trying to use it atop an array of multi-terabyte spinning drives. RAID 5 offers more resiliency than RAID 0, as well as significant gains in read operations for loading programs and games.
A note about RAID 5 and SSDs
We talked to software engineer Sam Baughman about SSDs in RAID 5. He told us that RAID 5 has the potential to wear out SSDs faster than normal due to the way RAID 5 parity data works.
" TRIM doesn't work as you'd expect; 1/(N) of each of the N drives will always be allocated, even when the array is empty, due to presence of RAID 5 parity data," he said. " The fewer drives in the array, the more significant the impact on SSD lifespan."
Baughman has been a software engineer for over 15 years and specializes in device drivers for stoage devices.
TRIM, in case you didn't know, helps the OS extend the liffetime of an SSD during delete operations. TRIM basically says, "Hey, these blocks aren't being used, you're cool to clear and write over that data."
"I've tested this on Linux, you will definitely see TRIM on the data blocks, but at least on the kernels I used in the 3.10 series, you'd never see a TRIM of the parity chunks, because parity is never 'freed'," Baughman said. " Logically it's possible for MD (Linux's RAID driver software) to do it, but the overhead would be significant and require its own metadata."
So basically, RAID 5 could chop down your SSD's lifespan if there are a lot of delete and write operations you're performing. Spinning HDDs don't have this problem at all, since TRIM isn't an issue.
We used SSDs in our example because that's what we had lying around. Before using RAID 5 with SSDs on your system, consider if you're willing to absorb the extra wear and tear. If you think you might replace the SSDs before they start to wear out, it may not be an issue.
" RAID 0 and RAID 1 rock with SSDs though, and TRIM works flawlessly with Linux MD on those levels," Baughman said.
Good to know, Sam.
Prepare your hardware
If you’ve been following along in our series, you’ll know that it’s always best to use drives of identical make, model, and capacity when constructing a RAID array. Even if you're forced to use different makes and models (as we were in our examples), you have to make sure that the drive capacities are identical. Mixing drives will at best result in an array that will performs as if each drive were the slowest one.
When connecting your drives for use in RAID, be sure to use the same interface for the drive. If two drives in your array are using SATA 6Gbps, use the same interface for every other drive you intend to add to the array.
It’s also a good idea to make sure all of the drives in your array are using the latest firmware. Firmware fixes can result in better speeds and fix potential bugs that can wreack havoc on your data.
If you’re going to use FakeRAID, make sure your motherboard has “onboard RAID.” Most recent motherboards do, but if you’re building a server out of an old machine, this is something you should check.
Windows: Storage Spaces
Creating a RAID 5 array in Windows is just as easy as creating RAID 0 and 1 arrays. It’s important to remember Microsoft uses the name “Storage Spaces” instead of RAID, but the function is pretty much the same.
To start, hit Win+S and search for “Storage spaces” and launch the utility. Next, click “create a new pool and storage space.” You’ll be prompted for administrator access. Click Yes to continue.
You’ll be greeted by a windows showing all of the unformatted disks that can be used. Select all the disks you want in the array and click “Create pool.” You’ll have to select at least three to be able to create a RAID 5 array.
In a perfect world, we'd use identical drives, but sometimes you have to use what you've got lying around. Reliability and speed could be negatively affected by using different drives.
Next, give the pool a name and drive letter. The name will appear as the drive label. Select NTFS as the file system. For Resiliency type, select “Parity,” which is the equivalent to RAID 5. When you’re ready, click Create storage space to create the array.
If you want to remove a RAID array for any reason, simply click Delete next to the storage space you want to remove. To remove the pool, remove all of the storage spaces in it first.