WHAT’S RAID6 AND HOW TO CONFIGURE IN LINUX

 

raid 6 in linux

HOW IT WORKS :

RAID stands for redundant array of independent disks.

Raid 6 is much more similar to raid 5 . Raid6 is also known as double parity.Fault tolerance is low as compared to raid 5. It requires minimum four disks . If two harddisks crashes , can recover data from remaining two . That’s why Raid 6 total size in my diagram is 2000MB . Because it can take data from any two. You can check my diagram how it distributes data .

HOW TO CONFIGURE RAID6 IN LINUX

  • Create four partitions .
  • Make sure all have same size .
  • Command n ( to create partition)
  • Command t  ( to change partition type)
  • Run partprobe command to save all your changes ( mandatory )
[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 65399.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (57368-65399, default 57368):
Using default value 57368
Last cylinder or +size or +sizeM or +sizeK (57368-65399, default 65399): +1000M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (57491-65399, default 57491):
Using default value 57491
Last cylinder or +size or +sizeM or +sizeK (57491-65399, default 65399): +1000M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (57614-65399, default 57614):
Using default value 57614
Last cylinder or +size or +sizeM or +sizeK (57614-65399, default 65399): +1000M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (57737-65399, default 57737):
Using default value 57737
Last cylinder or +size or +sizeM or +sizeK (57737-65399, default 65399): +1000M

Command (m for help): p
Disk /dev/sda: 537.9 GB, 537932857344 bytes
255 heads, 63 sectors/track, 65399 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       50993   409601241   83  Linux
/dev/sda2           50994       57367    51199155   82  Linux swap / Solaris
/dev/sda4           57368       65399    64517040    5  Extended
/dev/sda5           57368       57490      987966   83  Linux
/dev/sda6           57491       57613      987966   83  Linux
/dev/sda7           57614       57736      987966   83  Linux
/dev/sda8           57737       57859      987966   83  Linux

Command (m for help): t
Partition number (1-8): 8
Hex code (type L to list codes): fd
Changed system type of partition 8 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-8): 7
Hex code (type L to list codes): fd
Changed system type of partition 7 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-8): 6
Hex code (type L to list codes): fd
Changed system type of partition 6 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-8): 5
Hex code (type L to list codes): fd
Changed system type of partition 5 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@localhost ~]# partprobe /dev/sda
  • Check by running fdisk -l command , partition and its type
[root@localhost ~]# fdisk -l
Disk /dev/sda: 537.9 GB, 537932857344 bytes
255 heads, 63 sectors/track, 65399 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       50993   409601241   83  Linux
/dev/sda2           50994       57367    51199155   82  Linux swap / Solaris
/dev/sda4           57368       65399    64517040    5  Extended
/dev/sda5           57368       57490      987966   fd  Linux raid autodetect
/dev/sda6           57491       57613      987966   fd  Linux raid autodetect
/dev/sda7           57614       57736      987966   fd  Linux raid autodetect
/dev/sda8           57737       57859      987966   fd  Linux raid autodetect
  • Now create raid 6
  • /dev/md6 is a raid name that i want system to create .You can give any name like md1 , m2 , md5, md8 any .
  • –level=6 means we want to make raid 6
  • Add partition you want to add in this raid .
[root@localhost ~]# mdadm --create /dev/md6 --level=6 --raid-devices=4 /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8
mdadm: /dev/sda5 appears to contain an ext2fs file system
    size=1991296K  mtime=Thu Jan 19 21:27:42 2017
mdadm: /dev/sda7 appears to be part of a raid array:
    level=raid5 devices=3 ctime=Wed Jan 18 23:05:08 2017
mdadm: /dev/sda8 appears to be part of a raid array:
    level=raid1 devices=2 ctime=Tue Jan 17 00:57:01 2017
Continue creating array? yes
mdadm: array /dev/md6 started.
  • To check raid type  cat  /proc/mdstat command
[root@localhost ~]# cat /proc/mdstat
Personalities : [raid6] 
md6 : active raid6 sda8[3] sda7[2] sda6[1] sda5[0]
      1975680 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]
      [>....................]  resync =  0.7% (7252/987840) finish=15.6min speed=1036K/sec
unused devices: <none>
  • Format  /dev/md5
[root@localhost ~]# mkfs.ext3 /dev/md5
  • Now we will mount ( to save data ) that Raid .
  • To mount  type  =   mount    raidname  foldername
  • To check type  df  -h command
[root@localhost ~]# mount /dev/md5 3usageeks
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             379G  4.9G  355G   2% /
tmpfs                 947M     0  947M   0% /dev/shm
/dev/md6              1.9G   35M  1.8G   2% /root/3usageeks
  • That was temporary mounting , means it will be lost when system reboots .
  • For permanent mounting Go to /etc/fstab
[root@localhost ~]# vim /etc/fstab
  • And make entry as shown below  .
LABEL=/                 /                       ext3    defaults        1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda2         swap                    swap    defaults        0 0
/dev/md6                /root/3usageeks         ext3    defaults         0 0

 

Don’t hesitate to comment if you got any problem .

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s