Tuesday, March 31, 2015

raid configuration in linux step by step with example

http://linuxserverworldadmin.blogspot.in/2015/03/what-is-meant-by-raid-levels.html

http://linuxserverworldadmin.blogspot.in/2015/03/what-are-different-types-of-raid-levels.html



Example to Configure RAID 5 

Install the required packages 
[root@client1 ~]# yum install mdadm -y 

Create the required partition 

[root@client1 ~]# mdadm -C /dev/md0 -n3 /dev/hda11 /dev/hda12 /dev/hda13 -l5 
mdadm: array /dev/md0 started. 
To see the detail information of /dev/md0 

[root@client1 ~]# mdadm -D /dev/md0 

Format the raid meta device 

[root@client1 ~]# mkfs.ext3 /dev/md0 

Mount the partition 

[root@client1 ~]# mount /dev/md0 /raid_dir
 [root@client1 ~]# mount 
[root@client1 ~]# cd /raid_dir/
 [root@client1 raid_dir]# ls 
lost+found 

Write some content inside the raid partition 

[root@client1 raid_dir]# cat > test 
hello this is a test file on raid 5 
[root@client1 raid_dir]# ls -l 
To add a new device as spare 
[root@client1 ~]# mdadm -a /dev/md0 /dev/hda14 [root@client1 ~]# mdadm -D /dev/md0 
[root@client1 ~]# mdadm /dev/md0 -f /dev/hda12 mdadm: set /dev/hda12 faulty in /dev/md0 

To see the detail information of /dev/md0 
[root@client1 ~]# mdadm -D /dev/md0 
To remove the faulty device 

[root@client1 raid_dir]# mdadm /dev/md0 -r /dev/hda12 mdadm: hot removed /dev/hda12 

[root@client1 raid_dir]# mdadm -D /dev/md0
 [root@client1 raid_dir]# cd 

To stop the raid first unmount the meta device.

[root@client1 ~]# umount /dev/md0 

[root@client1 ~]# mdadm -S /dev/md0 mdadm: stopped /dev/md0 

To activate or assemble the raid meta device 

[root@client1 ~]# mdadm -A /dev/md0 /dev/hda11 /dev/hda14 /dev/hda13 mdadm: /dev/md0 has been started with 3 drives. 












No comments:

Post a Comment