Creating Software RAID on Ubuntu14.04 Server
How to create RAID using Ubuntu Software RAID. Including RAID 0, 1, 5 and 6.
Since 9.10, Ubuntu provides a very easy way to build RAID. You can build a RAID system using the graphical Ubuntu user interface. It does not require using the command-line anymore.
Note: Be aware of the fragile state of RAID support in Ubuntu and what it takes to get a reliable raid setup
Introduction
RAID is a method of using multiple hard drives to act as one. There are two purposes of RAID:
- Expand drive capacity: RAID 0. If you have 2 x 500 GB HDD then total space become 1 TB
- Prevent data loss in case of drive failure: RAID 1, RAID 5, and RAID 6. You can combine RAID 0 to other RAID, e.g RAID 0 + 1 become RAID 10.
There are three ways to create RAID:
- Software-RAID: Where the RAID is created by software.
- Hardware-RAID: A special controller used to build RAID. Hardware RAID is generally faster, and does not place load on the CPU, and hardware RAID can be used with any OS
The RAID software included with current versions of Linux (and Ubuntu) is based on the ‘mdadm’ driver and works very well.
Requirements
If you’re building a server, the server install CD includes the necessary options.
- At least 2 hard drives, preferably same size
After a successful install, you should also manually fix 2 shortcomings in the default configuration:
- Install GRUB boot-loader on second drive (this step is not necessary if you use Ubuntu 9.10 or a newer one, which uses Grub2)
- Update the startup script to detect a failed drive
Installing
Install Ubuntu until you get to partitioning the disks
Partitioning the disk
Warning: the /boot filesystem cannot use any softRAID level other than 1 with the stock Ubuntu bootloader. If you want to use some other RAID level for most things, you’ll need to create separate partitions and make a RAID1 device for /boot.
Warning: this will remove all data on hard drives.
1. Select “Manual” as your partition method
2. Select your hard drive, and agree to “Create a new empty partition table on this device ?”
3. Select the “FREE SPACE” on the 1st drive then select “automatically partition the free space
4. Ubuntu will create 2 partitions: / and swap, as shown below:
5. On / partition select “bootable flag” and set it to “on”
6. Repeat steps 2 to 5 for the other hard drive
As you see Ubuntu 9.10 makes RAID creation very easy. No need to define partition manually anymore! Ubuntu 9.10 also uses ext4, the latest Linux file system type.
Configuring the RAID
- Once you have completed your partitioning in the main “Partition Disks” page select “Configure Software RAID”
- Select “Yes”
- Select “Create new MD drive”
- Select RAID type: RAID 0, RAID 1, RAID 5 or RAID 6
- Number of devices. RAID 0 and 1 need 2 drives. 3 for RAID 5 and 4 for RAID 6.
- Number of spare devices. Enter 0 if you have no spare drive.
- select which partitions to use. Generally they will be sda1 and sdb1 or hda1 or hdb1. Generally the numbers will match and the different letters are for different hard drives.
- At this point the installation may become unresponsive; this is because the hard drives have already started the synchronization process. Repeat steps 3 to 7 with each pair of partitions you have created.
- Once done, select finish.
Formatting
Ubuntu 9.10 will automatically format your partitions.
Boot Loader
There are several problems reported by previous version of Ubuntu. But Ubuntu 9.10 already fixes them. In case your next HDD won’t boot then simply install Grub to another drive. Examples …
1 |
grub-install /dev/sdb |
1 |
grub-install /dev/sdc |