How to setup RAID 1 on LINUX Server

RAID 1 consists of an exact copy of a set of data on two or more disks; a classic RAID 1 mirrored pair contains two disks.

Linux


How to setup RAID 1 on LINUX

This article contains steps which give you the glance about “How to setup RAID 1 on your Linux server”. Things you will need:

  • More than one hard disk installed on your system.
  • Basic knowledge of Linux filesystem in case you come across any errors.Raid 1

So here is the step by step guide to setup RAID 1 on your system/server:

  • First, check the hard disks attached to the system using the command fdisk –l.

Here is what the output should look like.

Raid1

  • Create a RAID 1 partition:  Type mdadm –create /dev/md1 –level=1 –raid-devices=2 /dev/sdg /dev/sdh.

NOTE: replace “sdg” and “sdh” with the names of the hard disk on your server that you want to add in RAID.

Raid1

  • Create an ext4 filesystem for the RAID 1 partition: mke2fs  –t  -ext4  -j  /dev/md1.
  • Make directory for RAID1 partition: mkdir /raid1.
  • Mount the RAID1 partition on the directory: mount  /dev/md1  /raid1.
  • Edit the fstab file: vi  /etc/fstab.
    This is what the file should look like.Raid1
  • Find an empty line and type ##RAID## and hit enter.
  • Make a new entry: Type   /dev/md1   /raid1   ext4 defaults 1  2.NOTE: Type it the way shown in the highlighted section of the image below.

    RAID1
  • Save changes to file and exit by typing:   :wq
  • Mount the contents of the fstab file: Make sure you have exited the fstab file and you are back at the terminal then type: mount –a.
  • To see the RAID partition that you have just created type: df –h

    That’s all you need to setup RAID 1 on your server. Thanks for sticking with us through the article, hope this article helped. Stay tuned for more on codehotfix.com.

Leave a Comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: