Creating a RAID 5 Array in Ubuntu With MDADM

Embed Size (px)

Citation preview

  • 8/12/2019 Creating a RAID 5 Array in Ubuntu With MDADM

    1/2

    Creating a RAID 5 array in Ubuntu

    with MDADMWalkthrough

    Software RAID-5 is a cheap and easy way to create a virtual single drive from manyto store your files. Software RAID in Linux, viamdadm,offers lots of advanced

    features that are only normally available on harware RAID controller cards. A big one

    is the ability to grow the array of disks when you run out of space! Consider alsothat software RAID can move with youso if you decide to change motherboards or

    your RAID controller fails it is wont mean the end of the world.

    This guide details setting up software RAID 5 on Hardy Heron (8.04)Ubuntuusing

    mdadm after you have a running Ubuntu install. It does not cover everything you

    need to know about RAID and the knowledge in this document is by no means

    extensiveplease check out the further reading link for more information at the end

    of this article.

    There is an expectation that you have a basic understanding on how to use thecommand line (terminal) Its recommended that you are at least familiar with it before

    following this walkthrough.

    Before we get started, remember that no RAID solution is a viable replacement for

    regularly backing up your data! If your data is mission critical, make sure its

    backed either on removable media or on another device. We will cover this in anotherarticle.

    One: Prepare the Disks

    Open up a terminal window and run:

    sudo fdisk -l

    This will bring up a list of available disks.

    I will be using 4, 250gb Hard Disks (sdb1, sdc1, sdd1 and sde1) that I wish to

    combine into a RAID-5 volume. The disks are all currently unformatted andunpartitioned.

    We firstly need to format the drives (as ext3) and set the RAID flag. This can beeasily achieved with gPartEd. If you do not have Partition Editor on your System-

    >Administration menu, install it with this command:

    sudo apt-get install gparted

    http://en.wikipedia.org/wiki/Mdadmhttp://en.wikipedia.org/wiki/Mdadmhttp://en.wikipedia.org/wiki/Mdadmhttp://www.ubuntu.org/http://www.ubuntu.org/http://www.ubuntu.org/http://www.ubuntu.org/http://en.wikipedia.org/wiki/Mdadm
  • 8/12/2019 Creating a RAID 5 Array in Ubuntu With MDADM

    2/2

    In the Partition Editor application, select each disk in turn and format it to ext3.

    CAUTION! you will lose all data on the device you format.

    Once the format is complete, right click on each new volume you have created and

    select Manage Flags tick the RAID flag to indicate the disk will become part of

    a RAID set.

    Once you have your three disks set up, running fdisk -l (as root) should now indicate

    that those disks are correctly prepared to be created into the RAID 5 array.

    Two: Creating the RAID DeviceIf you dont already have mdadm (Mirrored Device Admin) installed, run thefollowing:

    sudo apt-get install mdadm

    You can now create your RAID volume (md0, if this is to be your first) by running:

    sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4

    /dev/sdb1 /dev/sdc1 /dev/sdd1 /sde1

    To further explain, --verbosewill display more information on the screen as the

    RAID is created (which is useful in case of problems), /dev/md0 is the RAID device

    to be created,--level=5dictates that we want to create a RAID 5 volume, and --

    raid-devices=4dictates that there are to be four drives in our raid array. Followingthis is a list of the disks you wish to assign to the array. For more information, you

    can run: mdadm --help-options

    When mdadm --create is run, your RAID device will be created

    Once the build is under-way, you can monitor its progress by running:

    sudo watch cat /proc/mdstat

    This command will display the status of mdadm, and refresh every 2 seconds. Whenyou are done watching, you can press CTRL+Cto escape back to the command line,

    or you can simply close the terminal window.

    Read More

    http://goo.gl/3uiZAZhttp://goo.gl/3uiZAZhttp://goo.gl/3uiZAZhttp://goo.gl/3uiZAZ