From LedHed's Wiki
Jump to: navigation, search

Linux Software RAID Most modern Distro's provide a way to create a RAID volume durring the install process. In my experience, Fedora fails to install the boot loader to both driver (assuming you are booting from an Array), and Ununtu fails to install the boot loader to either drive, this requires you to boot from the Ubuntu install CD, and choose the "boot from first harddisk" option.


To create a software RAID volume you must create a minimum of two partition of the same size (preferably on seperate physical disks)

Creating the partitions with fdisk

fdisk /dev/sda

This will partition the first physical SCSI drive

Command reference:

p = Print/View Drive partition information
d = Delete Partition
n = New partition
t = Partition Type (FAT16, FAT32, Linux, etc...)
w = Write changes to partition table
q = quit

After creating the partitions you need to change their type:

type = 82 (Linux RAID Autodetect)

Finish up by pressing 'w'

Now repeat the above process

fdisk /dev/sdb

Make sure to create a partition of EXACTLY the same size and type.

Creating the Array with MDADM

MDADM is a set of utilities to manage software RAID Arrays in Linux.

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

Repeat this for each set of corresponding partitions you've created, moifying /dev/mdx and /dev/sdx to correlate with the array number and partition number.

Formatting the Array

Choosing a filesystem goes way beyond the scope of this page, but here are a few examples:

mkfs.ext3 /dev/md0


mkfs.reiserfs /dev/md1

Follow the same procedure for any of the many Filesystems supported by Linux.

Booting from RAID Partitions

To boot from a RAID partition is much like booting from a single partition, you must install a boot loader. When creating a RAID 0 (Mirror) you will want to install grub (or lilo) to the boot sector of both drives. By doing this if 1 drive fails and you must reboot. The boot loader is available on either drive. Note: you may need to make changes to your BIOS to adjust for boot order.


>root (hd0,0)
>setup (hd0)

>root (hd1,0)
>setup (hd1)

You now need to make changes to your grub.conf (or menu.list depending on distro) You should find a few lines that look something like this:

title Fedora Core (2.6.20-1.2933.fc6)
       root (hd0,0)
       kernel /vmlinuz-2.6.20-1.2933.fc6 ro root=/dev/md1 rhgb quiet
       initrd /initrd-2.6.20-1.2933.fc6.img

Copy and change the title and drive numbers to match your second drive, it should look something like this:

title Fedora Core [mirror](2.6.20-1.2933.fc6)

       root (hd1,0)
       kernel /vmlinuz-2.6.20-1.2933.fc6 ro root=/dev/md1 rhgb quiet
       initrd /initrd-2.6.20-1.2933.fc6.img

Now if either drive fails, you can choose the Mirrored drive from the boot menu.

This category currently contains no pages or media.