Upgrade your data resiliency with RAID 1
The sound of a dying hard drive can be terrifying. It means a headache, downtime, and replacement costs in the best case. In the worst case, it means sending the drive to a data rescue lab. Using a redundant array of independent disks with mirroring (RAID 1), you can make a drive failure less of a nightmare.
RAID 1 is one of several RAID "levels," and is the polar opposite of it's speedier cousin, RAID 0. Where RAID 0 stripes data across drives to attain higher read and write performance, RAID 1 writes the same data across all the drives in the array. Using RAID 1, the chances of losing data to a drive failure is one divided by the number of drives in the array. In comparison, those chances are multiplied in RAID 0.
If you're thinking that RAID 1 is a lazy man's backup, think again. RAID 1 is not a backup, and is never, ever a replacement for a good backup. Always remember that RAID 1 is a hedge against hardware failures, not malware or corrupted data. If you get a virus on one drive in a RAID 1 array, every drive in the array will have the virus written to it. A proper backup keeps data safe from the system.
With all that doom and gloom about RAID 1 not being a backup, you're probably asking, "Why even bother with RAID 1?" The answer is pretty simple: If one drive in your RAID 1 array dies, the array will happily keep functioning, using one of the other drives for read and write operations. The failure will be nearly invisible to the user, as the RAID software should make the switch automatically. That's a big safety net for systems that simply cannot have downtime due to hardware failures.
Prepare your hardware
Just as with RAID 0, it's ideal to use identical drives in a RAID 1 array. If one drive is a different make, model, or isn't in mint condition, the array will only write as fast as the slowest drive. If a file is successfully written to a faster drive, the system will wait for the write to the slower drive to catch up.
In addition to using identical drives, be sure to use the same interface for the drive. If two drives in your array are using SATA 6Gb/s and the third is using SATA 3Gb/s, the array will throttle back to 3Gb/s.
It's also a good idea to make sure all of the drives in your array are using the latest firmware. This can be especially important when using SSDs.
If you're going to use FakeRAID, make sure your motherboard supports it. Most recent motherboards do, but if you're building a server out of an old machine, this is something you should check.
Finally, if you're going to be using a disk that has data on it in a RAID array, back up that data before you begin.
Windows: Storage Spaces
Creating a RAID 1 array in Windows is pretty simple, the trick is finding out what the utility is called. Microsoft opted for the name "Storage Spaces" instead of RAID, but the function is essentially 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.
Windows 8's built-in RAID utilities are referred to as "Storage Spaces."
You'll be greeted by a windows showing all the unformatted disks that can be used. Select all the disks you want in the array and click Create pool.
Storage Spaces will allow you to create a pool with any unformatted drives attached to the system.
Next, give the pool a name and drive letter. The name will appear as the drive label. Select NTFS as the filesystem. For Resiliency type, select Two-way mirror. This is the equivalent to RAID 1. When you're ready, click Create storage space to create the array.
For RAID 1 functionality in Storage Spaces, select "Two-way mirror."
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.
Next, we're going to cover setting up RAID 1 in Linux, and using your motherboard's onboard FakeRAID.
Linux: mdadm and Disks
Creating a software RAID 1 array in Linux takes all of two terminal commands. In Linux, the program mdadm (we like to pronounce it "madam"), is what we'll use to set up the array.
First things first: You need to get the RAID software. You'll need to download and install mdadm from your software repository. It's pretty common, and is included in most software repos. In Ubuntu, type the following command:
sudo apt-get install mdadm
Unless you're planning on running an email server, don't worry about installing all of the extras for Postfix.
The command will install mdadm for you, along with a dependency called Postfix. Postfix is a SMTP service that sends email. Postfix is included so that if a drive fails or something else happens to your array, the system can alert you with an email. That's great for IT administrators, but Postfix can be a bit of a bear to set up, so you can just set the program to use no configuration if you like.
Once mdadm is all set up, all you need to do is use the following command:
sudo mdadm --create /dev/mdX --level=1 --raid-devices=[number of drives] [drive name] [drive name] [etc]
The above command will vary based on the size of your array, and how you'd like to name it. RAID devices are generally named /dev/mdX where X is the index of the array. If you only have one array, it's a good idea to use 0 or 1. Drive names can be any valid Linux device path. Common examples use /dev/sda or /dev/disk/by-uuid/[UUID]. Once you create your array, you'll have to wait while the drives synchronize, which may take several minutes.
GNOME's Disks application (gnome-disk-utility) will display information about your RIAD array once it's created.
If you're not sure how Linux has identified your drives, you can use lsblk to identify them:
lsblk -o name,model,mountpoint,size
The command lsblk will show you the drives and storage devices you have connected to your system, and what device names Linux has assigned to them. The drives we used for our RAID array are outlined in red.
You can also create RAID arrays in Linux using the GNOME disk utility. In Ubuntu, search for "Disks" and open the utility. On the left side of the window, click the checkbox above the list of drives. Then, select the drives you want to use to create an array and click Create RAID.
While it's faster to create a RAID array from the terminal, you can create RAID arrays from GNOME's Disks application as well.
Software RAID 1 offers an advantage to Linux users who set up an array with mdadm: If you read more than one file at once, each drive can fetch a separate file, giving a net boost to read operations. The caveat is that this boost will only really show up in multi-threaded applications like web servers, and won't apply to most desktop use cases. Still, it's a nice perk for Linux users.
Using onboard FakeRAID
Onboard FakeRAID is harder to set up, but is your only real choice if you want your RAID array to be accessible to both Windows and Linux. You can also install an OS on top of a FakeRAID array. However, if you're only planning on using the RAID array from one OS, you're better off using the OS-based software solutions described above.
Once your drives are physically installed, boot into your BIOS by tapping the key prompted on startup. The message will say "Press DEL to enter Setup…" or something similar.
Once you're in your BIOS, look for an option called "SATA mode." This option is in different places for each motherboard manufacturer, so refer to your user manual if you can't find it. Once you've found the setting, change the setting from AHCI to RAID. This will let your onboard RAID software know that there are possible RAID devices to be started. When you're done, save and reboot.
If you're trying to enable FakeRAID with Windows already installed, Windows won't like that the SATA mode has changed. The OS will get grumpy and prompt you to reinstall Windows. You can, however, get around Windows' termpermental nature with a few steps. If you already changed the mode from AHCI to RAID and got the error, boot into the BIOS and change it back to AHCI. From inside Windows, open a command line using cmd and type in the following:
bcdedit /set {current} safeboot minimal
Then, reboot back into the BIOS and make the change. Once you've booted back into Windows, open up a command line again and type the following:
bcdedit /deletevalue {current} safeboot
Reboot once again, and Windows should be satiated.
In your BIOS, change the SATA mode from AHCI to RAID. Every BIOS is different, so the option may not appear as it does here.
On the next boot, you have to get into the RAID software to set up your arrays. If you have an Intel RAID controller, you should be prompted to hit CTRL+I to start the Intel Rapid Storage Technology (RST) RAID software. The software varies by vendor, so consult your motherboard manual on entering the RAID utility.
In Intel's RST menu, you should see some options and a list of hard drives on your system. Select "Create RAID Volume."
When you first start Intel RST, you disks will all be Non-RAID Disks.
On the next screen, give the RAID array a name and hit Enter. In the next field, use the up and down arrow keys to select the RAID level labeled "RAID 1 (Mirror)" and hit Enter again.
When creating your array, select "RAID1 (Mirror)."
Hit Enter again to create the volume. Confirm that you're OK with wiping everything off the disks in your array by typing Y.
Back on the home screen, you'll see a RAID volume, with the status of the disks used in the array changed from "Non-RAID disk" to "Member Disk." Use the down arrow to select Exit to save and exit the software.
After creating your array, you'll see the array name and the disks listed as "Member."
On the next boot, your FakeRAID array will appear as a single disk to the operating system. Additionally, RST will display the status of your RAID disks during the boot process, before the operating system loads.
While RAID 1 isn't a replacement for a backup, it is an excellent addition to any data resilience strategy.