From LedHed's Wiki
Jump to: navigation, search
 
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
'''Linux Software RAID'''
 
'''Linux Software RAID'''
MDADM is a set of utilities to manage software RAID Arrays in Linux
+
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.
Reference: http://www.linuxcommand.org/man_pages/mdadm8.html
+
 
+
Note: 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.
+
  
 
== Partitioning ==
 
== Partitioning ==
Line 10: Line 7:
  
  
Creating the partitions with fdisk
+
Creating the partitions with fdisk<br>
 
Reference: http://www.linuxcommand.org/man_pages/fdisk8.html
 
Reference: http://www.linuxcommand.org/man_pages/fdisk8.html
 
  fdisk /dev/sda
 
  fdisk /dev/sda
Line 32: Line 29:
  
 
Make sure to create a partition of EXACTLY the same size and type.
 
Make sure to create a partition of EXACTLY the same size and type.
 
  
 
== Creating the Array with MDADM==
 
== Creating the Array with MDADM==
 
+
MDADM is a set of utilities to manage software RAID Arrays in Linux.<br>
 
+
Reference: http://www.linuxcommand.org/man_pages/mdadm8.html
 +
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 ==
 
== Formatting the Array ==
Line 47: Line 45:
 
Follow the same procedure for any of the many Filesystems supported by Linux.
 
Follow the same procedure for any of the many Filesystems supported by Linux.
  
== Booting from RAID Partition ==
+
== 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.
 
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.
  
Line 62: Line 60:
 
You now need to make changes to your grub.conf (or menu.list depending on distro)
 
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:
 
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 that line and change the title and drive numbers to match your second drive, it should look something like this:
+
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.
 
Now if either drive fails, you can choose the Mirrored drive from the boot menu.
 +
 +
 +
[[Category:Linux]]

Latest revision as of 16:35, 22 October 2007

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.

Partitioning

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
Reference: http://www.linuxcommand.org/man_pages/fdisk8.html

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.
Reference: http://www.linuxcommand.org/man_pages/mdadm8.html

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

or

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.

Reference: http://www.linuxcommand.org/man_pages/grub8.html

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

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

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.