Setting Up RAID on an Existing Linux Desktop Computer

by Rob Locher

RAID Advantages

I was helping a friend work on a server, which has two hard drives in a RAID 1 mirror configuration.  I'd known about RAID for a long time, and I was curious, so I read about it.  I thought RAID was expensive, and just for servers.  It turns out that Linux offers software RAID that is only slightly slower than hardware RAID, which is still expensive.  (Windows has apparently also offered software RAID also since Windows XP.)  The more I learned, the more I was amazed that everyone doesn't use RAID for desktop computers, given how the cost of hard drives has plummeted.

RAID 1, mirroring, is conceptually simple; the RAID controller treats two or more hard drives as a single "logical block device", which the OS sees as just another hard drive.  Each drive that is part of a RAID 1 array keeps an identical copy of the data.  Writes are written to every hard drive; reads are read from the most convenient drive, or from multiple drives.  Compared to a single hard drive, writes are somewhat slower, and reads are somewhat faster.  True hardware RAID controllers offer the best performance, but at $500, I can't afford one.  "Fake" RAID on the motherboard, which is said to offer performance similar to software RAID, is available on many computers, but not on mine alas. 

RAID 1 is said to offer faster reading, since the controller can use whichever drive seeks to the data the quickest.  Writes are said to be slower, especially with software RAID, in which the data to be written has to be sent across the bus twice.  My gut feeling is that there will be a slight performance penalty to a computer with software RAID doing typical office chores, but not enough of a penalty to notice.  I'll soon find out for myself...

The nicest thing about a RAID 1 array of two hard drives is what happens when one of the drives in the array fails.  When that happens, the RAID controller reverts to using only the working hard drive; the data is still available, the computer continues to function normally, and an email is sent to notify the administrator of the fault.  If the failed drive is replaced before the good drive fails, then no data is lost and the computer remains fully usable.  After the failed drive is replaced the RAID controller copies the good drive to the new drive as a background process in a day or two, slightly degrading the array's performance in the meantime, and then we're back to full redundancy once again.

RAID 1 isn't perfect, and the the safety of the files isn't guaranteed: the two hard drives could fail simultaneously, or the house could burn down, so off-site backups are still required.  But replacing a failed drive in a RAID array sounds so much easier than the familiar two-day chore of reinstalling the operating system, downloading the OS updates, recovering the backup data, and reinstalling all the programs that I've endured so many times in the past after failures of solo hard drives.  Back when I ran Windows I needed to reinstall the OS periodically anyway to have the computer stay stable and reliable, but since I've switched to Linux that's no longer a concern.

Whole-Disk Encryption Advantages

About Whole-Disk Encryption

Step-by-Step

  1. sudo apt-get install cryptsetup necessary for Disks application to offer LUKS encryption