Linux Unix help !!

"Give respect to Time, One day at right Time, Time will respect You"

Tuesday, October 26, 2010

Software Raid

xxxxxxxxxxxxxxxxxx Raid using mdadm --By Shirish Shukla xxxxxxxxxxxxxxxxxxxx

### Configure raid0 of 700mb and mount it on /common2
        # fdisk  -l   <<---  verify raid partition
        # fdisk /dev/sda
            create 2 raid partition (type  fd) of 350mb each  say /dev/sda11 & /dev/sda12
        # partprobe  -s
        # fdisk  -l   <<---- confirm
        # mdadm     << just check is command appearing using tab.. if no install it from yum server
        # yum   –y   install mdadm*
        # mdadm  --create  /dev/md0  --level=0  --raid-devices=2  /dev/sda11  /dev/sda12
        # mkfs.ext3   /dev/md0    ß-format  md0
        # echo “DEVICE   /dev/sda11  /dev/sda12 “  > /etc/mdadm.conf
        # mdadm   --examine   --scan  --config=/etc/mdadm.conf   > > /etc/mdadm.conf
                    OR
        # mdadm –detail –scan >> /etc/mdadm.conf
        # cat /proc/mdstat     ß verify
        # vi /etc/fstab
            /dev/md0       /common2    ext3    defaults    0   0
        # mount –a
        # mount    or   # df   -h     ß----varify  /common to be have near about 700mb mounted.
         If above question will asked for RAID1, just change a single command:
        # mdadm  --create  /dev/md0  --level=1  --raid-devices=2  /dev/sda11  /dev/sda12
        all other same as above
RAID-1:
      # fdisk /dev/sdb
            ##create 2 raid partition (type  fd) of 350mb each  say /dev/sdb8 & /dev/sdb9
      # partprobe  -s
      # fdisk  -l   <<---- confirm
      ## Create Raid -1
      # mdadm  --create  /dev/md1  --level=1  --raid-devices=2  /dev/sdb8  /dev/sdb9
      # mkfs.ext3   /dev/md1    ß-format  md1
      # mdadm   --examine   --scan  --config=/etc/mdadm.conf   > > /etc/mdadm.conf
                    OR
     # mdadm –detail –scan >> /etc/mdadm.conf
     # cat /proc/mdstat     <<- verify
     ##Mount it on /EXTRA/RAID-1
    # mount /dev/md1  /EXTRA/RAID-1
   ###Recovery -- Suppose my raid partition 8 has been crashed Or have created it for 2 diff disks and my 1  st disk has crashed
  ## So how to recover data as have craeted mirror RAID, In our case /dev/sd9 conyain mirror data
  REcovery on Raid 1:
  # umount    /dec/mb1
  # mdadm --stop  /dev/md1
  # mount  -t  ext3   /dev/sdb9   /EXTRA/TEST   <-- Have a fun :)
 # Remount the RAID
 # mdadm --assemble /dev/md1
 # mount /dev/md1 /EXTRA/RAID-1

#Simulation
# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb8[0] sdb9[1]
      200704 blocks [2/2] [UU]

md0 : active raid0 sdb7[1] sdb6[0]
      305024 blocks 64k chunks

unused devices: <none>

## mdadm --detail /dev/md1
/dev/md1:
        Version : 00.90.03
  Creation Time : Wed Apr 13 09:58:15 2011
     Raid Level : raid1
     Array Size : 200704 (196.03 MiB 205.52 MB)
  Used Dev Size : 200704 (196.03 MiB 205.52 MB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 1
    Persistence : Superblock is persistent

    Update Time : Wed Apr 13 10:18:37 2011
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 44493b73:98b654f0:a313390c:1000baf6
         Events : 0.2

    Number   Major   Minor   RaidDevice State
       0       8       24        0      active sync   /dev/sdb8
       1       8       25        1      active sync   /dev/sdb9

##add the new replacement partition to the RAID. It will be resynchronized to the original partition
# mdadm --add /dev/md0 /dev/sda15
# mdadm --detail /dev/md0



# Faced any problem Feedback in above contact me
#===============================Scratch===============================#
# AND Many More .....................Linux is Endless                                                                          #
#========================== Hope you Liked IT ===========================#
#                                                                                                   RAID  -- BY Shirish Shukla #
#                                                                                                               RHC Engineer 2010 #
#                                                                                                          shirish.linux@gmail.com #
#                                                                                                          shirishlinux.blogspot.com #
#                            "Give Respect To Time One Day At Right Time, Time Will Respect You" #
#=====================================================================#
# TRy Hard theres nothing that are un-achievable by HARDdd-WORKkk                                   #
#=====================================================================#
Implement s/w raid linux, mdadm, raid0, raid 1, raid1, raid0, linux raid, how to configure raid on linux, linux raid configuration ....

2 comments:

Write Here .. your comments are always wellcome ..but no spam please !!

Followers

Pls LIKE my Story !!!