Tag: hard disk

  • Creating Software RAID 5

    Creating Software RAID 5

    RAID 5 Requires 3 or more physical disks. It provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.

    I have a server with 4 * 4 TB Disks. Here is parted -l result on the server.

    On this server /dev/sda, /dev/sdb, /dev/sdc and /dev/sdd are 4 TB disks and are not in use. Lets format these disk to be used as RAID 5.

    Following commands need to be executed for each of the disks.

    parted -a optimal /dev/sda
    mklabel gpt
    mkpart primary ext4 0% 100%
    set 1 raid on
    align-check optimal 1
    print
    quit
    

    This will partition the disks, set file system as raid.

    Repeat the steps for /dev/sdb, /dev/sdc and /dev/sdd.

    Now you have all disks formatted, ready to be used in raid array.

    Create RAID 5 array with command

    mdadm --create --verbose --level=5 --chunk=64 --raid-devices=4 --layout=left-symmetric /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
    

    Once raid created, you can see status with command

    cat /proc/mdstat
    

    Before we can use raid array, we need to create a file system on the raid with command

    mkfs.ext4 /dev/md0
    

    formatting raid 5 array

    Create mdadm.conf file with following command

    mkdir /etc/mdadm/
    cat /etc/mdadm/mdadm.conf
    mdadm --detail --scan >> /etc/mdadm/mdadm.conf
    cat /etc/mdadm/mdadm.conf
    

    Mount Raid 5 Array

    I want to mount the new raid 5 array as /home. For this i edited /etc/fstab, added

    /dev/md0        /home           ext4    errors=remount-ro 0       1
    

    After rebooting, i have 11 TB RAID 5 drive mounted as /home