When you have new LUNs created on the SAN fabric, zoned & mapped it to the server; how can you detect the luns on the linux server online, without rebooting it?.
When you dynamically add new disks to a Linux VM running on ESX server, how do you detect that disks on the Linux virtual machine?.
Here are the steps to do that :
- Install sg3_utils and lsscsi package.
[root@fedora01 ~]# # yum install –y sg3_utils lsscsi - The “lsscsi” command will list the disks attached to it. If you have just attached a disk, you will not be able to see it. You can also list this using “fdisk –l”
[root@fedora01 ~]# lsscsi
[0:0:0:0] disk VMware Virtual disk 1.0 /dev/sda
[root@fedora01 ~]#
As you can see above, I currently have one disk connected to the system. To scan for a new device I just added, we should run rescan-scsi-bus.sh from the host. - Run the command “/usr/bin/rescan-scsi-bus.sh” , to dynamically detect and activate the new disk. [root@fedora01 ~]# /usr/bin/rescan-scsi-bus.sh -l
Host adapter 0 (mptspi) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, LUNs 0 1 2 3 4 5 6 7
Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Scanning for device 0 0 1 0 ...
NEW: Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
1 new device(s) found.
0 device(s) removed.
[root@fedora01 ~]#
[root@fedora01 ~]# lsscsi
[0:0:0:0] disk VMware Virtual disk 1.0 /dev/sda
[0:0:1:0] disk VMware Virtual disk 1.0 /dev/sdb
[root@fedora01 ~]#
You see the new disk is visible. Now you can create a partition or filesystem on it.
After running those commands, check dmesg and /var/log/messages to see if there are any device detections. You can also do "fdisk -l" or "cat /proc/scsi/scsi" to see the attached LUNs. This works fine in RHEL5, SuSE 10, CentOS5, OEL5.
Thanks for the post. Keep it up with your writing skills.
ReplyDeleteLinux course in Pune