How to add a scsi device in rhel 6 without reboot
I have 3 disks, 2 existing disks(2x10Gb) and one new 5GB disk to this machine added online. Now run the fdisk –l | grep –i disk command to check whether the new disk detected or not.
It seems it is not detected .I can only see 2x10GBdisk in machine the new disk is not visible to the system. Since it is not visible to the system you need to rescan the scsi bus to get the new disk. Rescan can be issued using this command:
echo "- - -" > /sys/class/scsi_host/host#/scan
Replace host# with actual value such as host0 or host 1 like this. You can find scsi_host value using the following command:
ls /sys/class/scsi_host
Suppose if you have multiple scsi host values in the above command like what I have here.
Now you might be thinking how do I find the right scsi_hostvalue that you need to use with echo "- - -" > /sys/class/scsi_host/host#/scan command.
The below 2 commands helps you to find which is the correct scsi_host value you need to use.
grep mpt /sys/class/scsi_host/host?/proc_name
This command output help you to get the scsi_hostvalue. Here it is host2
Second option is to run the below command.
udevadm info -a -p /sys/class/scsi_generic/sg0
The output of this command will be big however I am attaching the snippet of the portion that we need to look for scsi host value .
Once you have scsi_host value with you now you are ready for scanning the scsi bus.
[root@vinil ~]# echo "- - -" > /sys/class/scsi_host/host2/scan ( in my machine scsi_host value is host2)
Now just verify the /var/log/messages you could see some messages that the new disk is available in os Similar to the below output:
Now you can run the fdisk –l |grep –i disk command to confirm that the new disk is available to OS. I could see my new 5Gb (/dev/sdc) disk in the fdisknow.
Now you can create partition using fdisk/cfdisk or parted its upto you.
Last updated
Was this helpful?