Friday 21 September 2012


How To Add New Disk To The Hardware Raid Controller Without Rebooting The Server In Linux:


First find out your RAID hardware as we will need appropriate OS utility to manage the same
from the same vendor. In our case it was lsi which can be managed via Megacli utility.

[root@server 8.02.21_Linux_MegaCLI]# lspci | grep -i raid
07:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
Lets first install the utilty :
To do this we need to install the Megacli utility on our server Centos6.2.

Step:1. Install the below two packages.
(downlaod from http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.21_MegaCLI.zip) .
#rpm -ivh Lib_Utils-1.00-09.noarch.rpm
#rpm -ivh MegaCli-8.02.21-1.noarch.rpm

Step:2. By default the utility is placed at location as below..
[root@server 8.02.21_Linux_MegaCLI]# cd /opt/MegaRAID/MegaCli/
[root@server MegaCli]# ls
install.log MegaCli64 MegaSAS.log

Step:3. Run the below command before adding the brand new disk drive.
[root@server MegaCli]# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll | grep -e “Enclosure Device ID” -e Slot
Enclosure Device ID: 252
Slot Number: 0
Enclosure Device ID: 252
Slot Number: 1

Step:4. Run the command again after injecting the new HDD in drive slot.
[root@server MegaCli]# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll | grep -e “Enclosure Device ID” -e Slot
Enclosure Device ID: 252
Slot Number: 0
Enclosure Device ID: 252
Slot Number: 1
Enclosure Device ID: 252
Slot Number: 3

Step:5. Now you have the following information the Enclosure Device ID: 252 and Slot Number: 3 for the newly added drive.

Step:6. Once added the new drive will be in foreign state. Give the below command to clear the foreign status.
[root@server MegaCli]#/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Clear -aALL

Step:7. Add the new drive to the desired RAID level by running below command.
#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0 [252:3] -a0
Options:
-r1 = RAID1
252 = Enclosure Device ID
2 and 3 = Slot Number
-a0 = Adapter
In our case :
-r0 = RAID0
252 = Enclosure Device ID
3 = Slot Number
-a0 = Adapter

Step:8. tail the /var/log/messages for the new disk
sd 0:2:1:0: [sdb] Mode Sense: 1f 00 00 08
sd 0:2:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
sdb: sdb1 sdb2
sd 0:2:1:0: [sdb] Attached SCSI disk

Now you can use the new disk as any other normal drive.

1 comment: