This utility helps to manage software raid devices on Linux. RAID devices are virtual devices created from two or more real block devices. This allows multiple devices to be combined into a single device to hold a single filesystem.  Some RAID levels include redundancy and so can survive some degre of disk failure.

Creating Raid Group md0 with local disks:

This command creates a RAID5 device named /dev/md0, with 3 disks /dev/sdb /dev/sdc /dev/sdd.

[root@foo15 ~]# mdadm –create –verbose /dev/md0 –level=5 –raid-devices=3 /dev/sdb /dev/sdc /dev/sdd
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: array /dev/md0 started.

Details of device md0(/dev/md0) using fdisk

Once /dev/md0 is created, you should be able to see the details using fdisk.

[root@foo15 ~]# fdisk -l /dev/md0
Disk /dev/md0: 293.6 GB, 293631295488 bytes
2 heads, 4 sectors/track, 71687328 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

 
Details of the md disk using mdadm command

[root@foo15 ~]# mdadm –detail /dev/md0
/dev/md0:
        Version : 00.90.03
  Creation Time : Thu Sep 02 06:24:10 2008
     Raid Level : raid5
     Array Size : 286749312 (273.47 GiB 293.63 GB)
  Used Dev Size : 143374656 (136.73 GiB 146.82 GB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Thu Sep 02 07:01:44 2008
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 64K

           UUID : 0366e343:0366e343:0366e343:0366e343
         Events : 0.2

    Number   Major   Minor   RaidDevice State
       0       8       16        0      active sync   /dev/sdb
       1       8       32        1      active sync   /dev/sdc
       2       8       48        2      active sync   /dev/sdd

How to keep /dev/md0 persistant across reboots?

Add the md device entry to /etc/mdadm.conf

[root@foo15 ~]# mdadm -Es |grep md0
ARRAY /dev/md0 level=raid5 num-devices=3 UUID=0366e343:0366e343:0366e343:0366e343
[root@foo15 ~]# mdadm -Es |grep md0 >> /etc/mdadm.conf

Adding a disk to /dev/md0

[root@foo15 ~]# mdadm /dev/md0 -a /dev/sde
mdadm: added /dev/sde

/proc file for madadm : /proc/mdstat

[root@foo15 proc]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdb[0] sdd[2] sdc[1]
      286749312 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>
[root@foo15 proc]#

0 Shares:
Leave a Reply

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

You May Also Like
Read More

rsyslogd

Rsyslog is an enhanced multi-threaded syslogd system utility providing support for message logging.  Support of both internet and…