RAID 5 on Ubuntu desktop is a pain. The Ubuntu alternate edition makes desktop RAID easy. Build yourself a power workstation using RAID 5.
My test machine has the Ubuntu system installed in a solid state disk for speed. I will add three disks for data using a RAID 5 array.
You need Ubuntu set up on a system disk. The process is described in Ubuntu 10.10 desktop installation.
Next you need some disks. RAID needs a minimum of 3 disks for RAID 5 and I have 3 disks spare. You can use more if they will fit in your computer case. The RAID size will be set by the smallest disk and the speed by the slowest disk. Use a set of disks all the same size and speed. I am using 2 TB disks and will end up with a 4 TB partition in the RAID array. The size is always 1 disk less than the total. If I had 6 disks, the maximum that will fit the case, I would have a 10 TB partition.
Install RAID software
Ubuntu desktop does not have RAID software installed by default. I mention how to install the RAID software in the desktop installation page. Here are the instructions from that page.
After installation of Ubuntu, reboot, log in to your new Linux system using one disk.
Ubuntu software center. Search for
mdadm. Select the
Install option. A screen will pop up for
Postfix configuration. Select
Forward twice to fix Postfix. Mdadm is installed and ready for RAID.
Prepare the spare disks
Disk Utility to manage disk partitions.
On the spare disks, the ones other than your system disk, delete the existing partitions you do not want. The disks are really only useful if empty. Any other configuration is too difficult. Move all data off the target disks then delete all the partitions.
I have new disks so formatted them. You get the choice of MBR or GPT (GUID Partion Table). MBR is for everything up to 2 TB. GPT is for everything over 2 TB. Your computer has a standard BIOS called a PC/BIOS. Future computers will use a BIOS called EFT. GPT is designed for EFI. Linux, the better versions of Unix, and the better versions of Windows work with GPT on EFI. Some versions of Linux and Unix work with GPT on PC/BIOS. Remember to make sure your next computer has an EFI BIOS so you can use the 3 TB disks when they arrive.
2 TB is old hat
3.3 TB disks are already possible with the current technology used in some 2 TB disks and is delayed only because BIOS manufacturers, Microsoft, and major computer brands are slack moles who put profit before customers and sell you the oldest possible technology they can get away with. The give you blue LEDs in the fans but not thermostatically controlled fans. They give you stainless steel cases but not EFI. Well, they are not using stainless steel yet. That will be next. Apple copies the trends from fashion magazines and eventually they will notice the refrigerators with stainless steel glued to the front of the door.
Create the RAID partition
Disk Utility, select
Create, code>RAID array to create the RAID array. You select the three disks as part of the process. After the RAID starts to build, walk away from the system for a while because large disks take a long time to format.
Create RAID Array, text-align:center select
Distributed Parity (RAID-5). The array name can be anything you want. The stripe size is a contentious issue and should be smaller than the default 512 KB, perhaps as small as 8 KB in some situations. I use 64 KB because 64 KB is used by some experts. You then select all the disks you want to use, in this case 3, then
After you select Create, you are presented with a screen where you choose
Format Volume. The formating will ask you for a file type and the default ext4 is ok. You can also provide a partition name. This is the name used in file related pages as the name for the partition. I will place the home partition there and name the partition Home or similar.
RAID stripe size
The default RAID 5 stripe size is 512 KB despite many years of performance testing and recommendations of 64 KB. What is the best size? Nobody knows.
See Linux RAID, a rant.
Large stripe sizes might work for some hardware and might work for video files. Large stripe sizes make some reads faster while making most writes slower. Large stripe sizes are designed to reduce some types of problems that are less common when you use whole disks for your RAID partitions.
What is really need is disk administration that configures RAID partitions based on the partition size, location, and the characteristics of the file system to be used on the partition. You should be able to specify read or update oriented plus small or large file orientation. Small files benefit most from small strip sizes when the file system block allocation and RAID stripe size work together. Database updates work the same as small file sizes. If a database updates a database using 4 KB pages, a 4KB file allocation block and 4 KB strip size should work best.
RAID stripe size is further complicated by the stripe relationship to number of disks. When you write a 4 KB stripe across RAID 5, you are not writing 4KB across all the disks, you are writing 4 KB per disk. If you are writing a 4 KB file system allocation block to my 3 disk RAID 5 array, you are writing 2 KB to each of 2 data disks and 2 KB of parity to the third disk. To write 4 KB to a 5 disk array, 4 data disks plus a parity disk, you write 1 KB to each data disk. Using the example of a database writing 4 KB pages, you would use a stripe size of 2 KB on a 3 disk array and a stripe size of 1 KB on a 5 disk array.
512 KB stripes start to seem silly when you look at actual examples of use.
Go have a sleep
When you finish the formatting, mount the RAID array as a partition and think you are finished, the RAID array starts to synchronize. Synchronizing takes ages, over an hour for 2 TB. Go get some sleep.
After the disks are synchronized, you have to move your home partition or similar to the new partition. I will tackle that tomorrow after a sleep.