2

I'm having a little issue. I've a live system which run on RHEL 6.7 (VM) and have VMware 6.5 (which is not managed by our group) . The issue is, the other group tried to extend the capacity of an existing disk on a VM. After that, I ran a scan command to detect new disk as usual with echo "- - -" > /sys/class/scsi_host/host0/scan, but nothing happened. They added 40G on sdb disk which should be 100G and I saw that is changed on VM but not in Linux. So where is the problem ? As I said, this is a live system, so I don't want to reboot it.

Here is the system :

# df -h /dev/mapper/itsmvg-bmclv
                       59G   47G  9.1G  84% /opt/bmc

# lsblk sdb                          8:16   0   60G  0 disk  └─itsmvg-bmclv (dm-2)      253:2    0   60G  0 lvm  /opt/bmc

# vgs   VG       #PV #LV #SN Attr   VSize  VFree    itsmvg     1   1   0 wz--n- 59.94g     0 

# pwd   /sys/class/scsi_host

# ll lrwxrwxrwx 1 root root 0 Nov 13 16:18 host0 -> ../../devices/pci0000:00/0000:00:07.1/host0/scsi_host/host0 lrwxrwxrwx 1 root root 0 Nov 13 16:19 host1 -> ../../devices/pci0000:00/0000:00:07.1/host1/scsi_host/host1 lrwxrwxrwx 1 root root 0 Nov 13 16:19 host2 -> ../../devices/pci0000:00/0000:00:15.0/0000:03:00.0/host2/scsi_host/host2
3

Below is the command that you need to run to scan the host devices so it will show the new hard disk connected.

echo "- - -" >> /sys/class/scsi_host/host_$i/scan

$i is the host number

  • As I said in the question, I already run echo "- - -" > /sys/class/scsi_host/host0/scan (and host1 & host2) . But nothing happend. What's wrong ? – Sensei Nov 14 '17 at 7:36
  • Use below command echo 1 >>/sys/class/scsi_device/device/rescan – Praveen Kumar BS Nov 14 '17 at 7:54
  • For scanning exsisting hd need to use above command which i mentioned – Praveen Kumar BS Nov 14 '17 at 7:55
  • The problem is solved. I don't know why but when they extend the existing disk on VM, linux didn't detect it with command i mentioned. But I just wanna try add new disk , not expand existing disk; it is fixed. So should I run echo “- - -“ >> /sys/class/scsi_host/host_$i/scan after expand disk ? and what is echo 1 >>/sys/class/scsi_device/device/rescan command do ? – Sensei Nov 14 '17 at 8:13
  • @Praveen, your formatting, come on... – Stephen Kitt Nov 14 '17 at 9:34
0

As was mentioned above, you have to scan all hosts there is full command with loop on one line (please change the range 0-32 if you have different – just list /sys/class/scsi_host/ ):

for i in `seq 0 32`; do echo "- - -" | sudo tee /sys/class/scsi_host/host$i/scan; ls /dev/sd* ; done

and the result:

$ for i in `seq 1 32`; do echo "- - -" | sudo tee /sys/class/scsi_host/host$i/scan; ls /dev/sd* ; done
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1

    ︙  thirty two times ;-)

- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1  /dev/sdd  /dev/sdd1

The last line shows us /dev/sdd device was discovered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.