The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Software RAID 1 (mirror) CentOS 4.2 64bit

Discussion in 'General Discussion' started by Tagor, Feb 4, 2006.

  1. Tagor

    Tagor Well-Known Member

    Joined:
    Mar 6, 2004
    Messages:
    193
    Likes Received:
    0
    Trophy Points:
    16
    Has someone a good tutorial for setting up a software raid 1 in CentOS 4.2 64bit?

    Thanks a lot :)
     
  2. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    What software is good for creating a RAID? That is usually hardware and needs no setup, except in the BIOS of the machine. Hardware is definitely the way to go.
     
    #2 lloyd_tennison, Feb 4, 2006
    Last edited: Feb 5, 2006
  3. Tagor

    Tagor Well-Known Member

    Joined:
    Mar 6, 2004
    Messages:
    193
    Likes Received:
    0
    Trophy Points:
    16
    There is already RAID software in CentOS (/etc/raidtab).
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
  5. DigitalN

    DigitalN Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    420
    Likes Received:
    1
    Trophy Points:
    18
    Software Raid is a great thing - running / software raid on all of our servers without any problems and hassles that come associated with Hardware raid rebuilds and cards that die etc.

    I use a live cd to do installs but setting up RAID 1 is a pretty simple task - I use mdadm

    The setup on redhat/centos is much the same as any other distro,

    Basically this is what you need to do with a new install, using cd

    Partition the disk as you would like, make sure to partition each disk the same. Select linux software raid as the file system type. Do this for every partition that you want tobe in raid1.

    Then, select create raid device, select the level, raid 1, then select the 2 partitions that you created earlier, eg.

    /dev/sda1, /dev/sdc1
    /dev/sda2, /dev/sdc2

    Then, go through each RAID device that has been created and enter the mount point and select the file system type,eg /boot , ext3 bootable. Do this for each partition - Its really straight forward and there are tons of tips on google if you get stuck.

    If you have a live cd, then I usually create the partitions, create the raid devices and install debian into it using debootstrap

    Bit like so,

    Partition /dev/sda, make all partitons type fd (linux raid , autodetect.

    Then dump the partition table

    # sfdisk -d /dev/sda > sda.sf

    Edit the file sda.sf and change, sda to sdb, wherever it occurs.

    The use that to create the partitions on the second disk

    # sfdisk /dev/sdb < sda.sf

    Right, now to create the raid devices and format the disks

    # mdadm --create --level=1 --raid-devices=2 --spare-devices=0 /dev/md0 /dev/sda1 /dev/sdc1

    Change /dev/md0 and the sdax sdcx as needed, for each partition, so you end up something like this

    /dev/md0 - /dev/sda1 /dev/sdc1 - mount point /boot
    /dev/md1 - /dev/sda2 /dev/sdc2 - mount point /
    /dev/md2 - /dev/sda3 /dev/sdc3 - mount point /var

    and so on

    Once the raid devices are created, just format them

    # mke2fs -j /dev/md0

    # mke2fs -j /dev/md1

    # mke2fs -j /dev/md2

    # mkswap /dev/mdx (whichever you choose for swap, if you include that in the raid.

    To view the created raids,

    # mdadm --detail --scan

    # mdadm --detail --scan > mdadm.conf

    If you want to create a mdadm.conf :)

    # cat /proc/mdstat

    Will tell you how the raid devices are doing.

    Then you can mount them,

    # mkdir /target

    # mount /dev/md1 /target
    # mkdir /target/boot
    # mount /dev/md0 /target/boot

    and so on...

    Installing debian couldn't be easier from there, but then this is the cpanel forums and we won't go into that one.

    I would also advise using/compiling a kernel that has compiled in raid 1 support, rather than using a module and initrd...

    Software raid rocks!
     
    #5 DigitalN, Feb 7, 2006
    Last edited: Feb 7, 2006
Loading...

Share This Page