RAID50 AND ITS CONFIGURATION IN LINUX .

raid 50 in linux

HOW IT WORKS :

Let data be 1, 2, 3 , 4 ,5 and 6 .  Raid50 is a combination of raid5 and raid0 . First in this raid system is raid 0 which spreads data in a way like 1, 3, 5 goes to one partition and 2, 4, 6 to another partition. Raid 0 requires minimum two harddisks . So both the partition holds the data , so its size is /dev/md0 (raid0) 2000MB . Then comes raid5 which uses both stripping with parity . It requires minimum three harddisks. And you can see in the diagram how it distributes data . If one harddisk crashes Raid5 can take data from remaining  two harddisks.

CONFIGURE RAID50 IN LINUX

  • Create six  partitions  for raid 50
[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 (57430-65399, default 57430):
Using default value 57430
Last cylinder or +size or +sizeM or +sizeK (57430-65399, default 65399): +500M

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

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

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

Command (m for help): n 
Command action l logical (5 or over) p primary partition (1-4) 
l 
First cylinder (57554-65399, default 57554): 
Using default value 57554 
Last cylinder or +size or +sizeM or +sizeK (57554-57992, default 57992): +500M
  • Also we have to change partition type to raid .
  • Command t    ( to change partition type)
  • Hex code for linux raid    –    fd
  • Command w  ( to save and exit )
Command (m for help): t
Partition number (1-10): 10
Hex code (type L to list codes): fd
Changed system type of partition 10 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-10): 9
Hex code (type L to list codes): fd
Changed system type of partition 9 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-10): 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-10): 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-10): 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-10): 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.
  • Make sue you run partprobe command to save all changes you made .
[root@localhost ~]# partprobe /dev/sda
  •  fdisk -l command  to check 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       57429      497983+  fd  Linux raid autodetect
/dev/sda6           57430       57491      497983+  fd  Linux raid autodetect
/dev/sda7           57993       58054      497983+  fd  Linux raid autodetect
/dev/sda8           58055       58116      497983+  fd  Linux raid autodetect
/dev/sda9           57492       57553      497983+  fd  Linux raid autodetect
/dev/sda10          57554       57615      497983+  fd  Linux raid autodetect
  • Now your partition is ready
  • Let’s create raid
  • After madam –create give raid name like /dev/md1 or md2 , md3 , md8 any name you like .
  • –level=5 defines that we want /dev/md1 to be Raid 5
  • Then which raid partition you want to include .
[root@localhost ~]# mdadm --create /dev/md1 --level=5 --raid-devices=3 /dev/sda5 /dev/sda6 /dev/sda7
mdadm: /dev/sda5 appears to be part of a raid array:
    level=raid1 devices=2 ctime=Thu Jan 19 03:58:38 2017
mdadm: /dev/sda6 appears to be part of a raid array:
    level=raid1 devices=2 ctime=Thu Jan 19 03:58:38 2017
Continue creating array? yes
mdadm: array /dev/md1 started.
  • Now create /dev/md2 including sda8 , sda9 and sda10  ( as shown in diagram )
  • It is also raid 5 , so level will be 5
  • It might ask “Continue creating array ” Type yes and hit Enter .
  • To allow system to create raid .
[root@localhost ~]# mdadm --create /dev/md2 --level=5 --raid-devices=3 /dev/sda8 /dev/sda9 /dev/sda10
mdadm: /dev/sda9 appears to be part of a raid array:
    level=raid1 devices=2 ctime=Thu Jan 19 03:58:38 2017
Continue creating array? yes
mdadm: array /dev/md2 started.
  • Now we have to combine both Raid 5 ( /dev/md1 and /dev/md2) and make raid 0 ( /dev/md0)
  • Here level will be 0 (raid0)
  • RAid 0 requires 2 partitions , so type /dev/md1 and /dev/md2
[root@localhost ~]# mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/md1 /dev/md2
mdadm: array /dev/md0 started.
  • Type cat  /proc/mdstat command to heck whether has been created or not .
  • md2 (raid5)is active on sda10 ,sda9 and sda8
  • md1 (raid 5) is active on sda7 , sda6 and sda5
  • md0 (raid0) is active on md2 and md1
[root@localhost ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid0]
md2 : active raid5 sda10[2] sda9[1] sda8[0]
      995712 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
md1 : active raid5 sda7[2] sda6[1] sda5[0]
      995712 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
md0 : active raid0 md2[1] md1[0]
      1991296 blocks 64k chunks
unused devices:
  • Format the /dev/md0 before mounting ( to save data)to any folder
[root@localhost ~]# mkfs.ext3 /dev/md0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
249344 inodes, 497824 blocks
24891 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=511705088
16 block groups
32768 blocks per group, 32768 fragments per group
15584 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
  • Create folder where you want to mount raid 50
  • Like i’m having Deepit folder
  • To mount type  –   mount   raidname  foldername
  • Check by df  -h command
[root@localhost ~]# mount /dev/md0 Deepit
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             379G  7.5G  352G   3% /
tmpfs                 947M     0  947M   0% /dev/shm
/dev/md0              1.9G   35M  1.8G   2% /root/Deepit
  • But that was temporary mounting , when you reboot raid50 will be lost
  • For permanent mounting go to /etc/fstab
[root@localhost ~]# vim /etc/fstab
  • Make entry as shown below
  • First what you want to mount
  • Second Where you want to mount
  • Third file type ( You might remember while formatting we use mkfs.ext3 that defines format in ext3)
  • Rest will be same
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/md0                /root/Deepit            ext3    defaults        0 0
~
  • Press ESC and :wq ( to save and quit)
~
~
~
:wq

HOW TO REMOVE RAID50 IN LINUX

  • Simply unmount the folder .
  • To unmount type  –   umount foldername
  • Check by df  -h command
[root@localhost ~]# umount Deepit
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             379G  7.5G  352G   3% /
tmpfs                 947M     0  947M   0% /dev/shm
  • Now we have to remove raid . First stop raid and then remove it . And start removing from top
  • To stop  =    mdadm     –stop   raidname
  • To remove  = mdadm     –remove   raidname
[root@localhost ~]# mdadm --stop /dev/md0
mdadm: stopped /dev/md0
[root@localhost ~]# mdadm --remove /dev/md0
[root@localhost ~]# mdadm --stop /dev/md1
mdadm: stopped /dev/md1
[root@localhost ~]# mdadm --remove /dev/md1
[root@localhost ~]# mdadm --stop /dev/md2
mdadm: stopped /dev/md2
[root@localhost ~]# mdadm --remove /dev/md2
  • Check raid is removed or not by cat  /proc/mdstat command
[root@localhost ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid0]
unused devices:
  • Delete the partitions .
  • Command d ( to delete the partition )
  • Command p  ( to print )
[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): d
Partition number (1-10): 10

Command (m for help): d
Partition number (1-9): 9

Command (m for help): d
Partition number (1-8): 8

Command (m for help): d
Partition number (1-7): 7

Command (m for help): d
Partition number (1-6): 6

Command (m for help): d
Partition number (1-5): 5

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

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.
  • Don’t forget to run partprobe command after deleting partitions .
[root@localhost ~]# partprobe /dev/sda

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

RAID 100 – HOW TO CONFIGURE/DELETE RAID 100 IN LINUX

KDE – HOW TO INSTALL KDE DESKTOP IN LINUX & GET START BUTTON (WINDOWS ) IN LINUX .

HOW TO COMBINE FILES IN A SINGLE FILE AND HOW TO COMPRESS FILE IN LINUX

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