Manage your software RAIDs

RAID: You must know about RAIDs if you are in hosting industry. As client or as an server admin. As a client, we must have idea about various types of RAIDs with their functionality and advantages-disadvantages then n then only we can choose best server hardware for us. Sysadmin must know the RAID administration part, to provide best quality support to premium clients.

RAID types: Basically, there are 2 types of RAIDs available.

1. Hardware Raid : Its managed by hardware RAID controller.

Eg. 3ware/Sas/Megasas/Adaptec etc.

2. Software Raid : Its managed by/throgh OS.

Now, how to manage software raids.

In this article we will learn about points,

1. Check existing software RAID configuration.
2. How to create a new RAID device.
3. Replacing a faulty device.
4. How to add device existing array.
5. Deactivating and removing an existing RAID device.

1. cat /proc/mdstat : All presently active RAID devices are stored in the /proc/mdstat file. With this command we can check our existing RAID type. It will show the list of devices.

2. mdadm –query /dev/md2 : To see more informaiton about the RAID device. To display more detailed information, use the following command,
# mdadm –detail /dev/md2

3. Steps to create new software raid device.

Make sure that your server is having two unused disk drives available,
# mdadm –create /dev/md2 –level=1 –raid-devices=1 /dev/sdc1 /dev/sdd1

4. Replacing a faulty device. To do so, first mark the /dev/sdb1 device as faulty:

# mdadm /dev/md2 –fail /dev/sdb1

Then remove it from the RAID device:

# mdadm /dev/md2 –remove /dev/sdb1

As soon as the hardware is replaced, you can add the device back to the array by using the following command:

# mdadm /dev/md2 –add /dev/sdb1

5. Extending a RAID Device

# mdadm /dev/md2 –add /dev/sdc1
# mdadm –grow /dev/md2 –raid-devices=2

6. Removing a RAID Device first deactivate it by running the following command as

#mdadm –stop raid_device
#mdadm –remove raid_device

7. Removing a RAID device

# mdadm –detail /dev/md2

First stop it by typing the following at a shell prompt before removing it

# mdadm –stop /dev/md2

After that you can remove it using command

# mdadm –remove /dev/md3