Linux RAID-EN

Da PoliArch.

Altre Pagine: · Home Page · Documentazione · Downloads · Screenshots · Contatti

Introduction

mdadm is one of the most advanced Linux software for the software array management.

Configuration

One of the main configuration files of mdadm is "/etc/mdadm.conf" that allows to trace software RAIDs.

Warning: The use of "mdadm.conf" can be useful, but is not mandatory!

For example, if the array doesn't start, the mdadm.conf file is useful because allows to determinate the array properties. However, generally is better to create the mdadm.conf file because, without it, every time that we execute the 'mdadm' command for raid management/activation, we should specify more information on the array.

It's possible to create mdadm.conf file using a text editor (for example nano, vi, mcedit, etc.) and adding the following directives, adapting them to our needs:

DEVICE                     /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
ARRAY                      /dev/md0 devices=/dev/sdc1,/dev/sdd1
ARRAY                      /dev/md1 devices=/dev/sde1,/dev/sdf1

On the first row "DEVICE" are specified the disks that will be part of the array. The second row "ARRAY /dev/md0..." create a first array composed of sdc1 and sdd1 disks. The third and last row "ARRAY /dev/md1..." create a second array composed of sde1 and sdf1 disks.

Alternatively we can use the 'mdadm' command for the file mdadm.conf creation:

# mdadm --detail --scan > /etc/mdadm.conf

Array Creation

The partitions that are part of an array must have the filesystem ID partition type setted on "FD". This can be done using a partitioning tool, like 'fdisk', 'qpart', 'cfdisk' or any other.

Create a "RAID-0" on "/dev/md0", using the partitions "/dev/sdb1" and "/dev/sdc1":

# mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1

or using the short version of the same command:

# mdadm -Cv /dev/md0 -l0 -n2 -c128 /dev/sdb1 /dev/sdc1

Start an Array

If the file "mdadm.conf" has been created, the command will be the following:

# mdadm -As /dev/md0 

Note: (-A assembles, s scan)

If otherwise you have NOT created the "mdadm.conf" file, the command will be the following:

# mdadm -A /dev/md0 /dev/sdb1 /dev/sdc1

Stop an Array

# mdadm -S /dev/md0

Add a disk to the array

If we want to add a disk sdh1 to the array md0:

# mdadm /dev/md0 --add /dev/sdh1

Remove a disk from the array

If we want to remove the sdh1 disk from the md0 array:

# mdadm /dev/md0 --fail /dev/sdc1 --remove /dev/sdc1

Monitor an Array

Examine an array:

# mdadm -E /dev/sdb1

Monitor an array:

# mdadm --monitor --delay=300 /dev/md0

Get information on the executing array:

# cat /proc/mdstat

Notes

For further information on the mdadm sintax and options:

# man mdadm

External links

Altre Pagine: · Home Page · Documentazione · Downloads · Screenshots · Contatti