User Tools

Site Tools


linux:discover_devices

This is an old revision of the document!


Discover new devices

Rescan scsi bus, and recreate multipathing (mpath)

[root@centos01 ~]# scsi-rescan -a -m -r -l

Install sg3_utils and lsscsi package. scsi-rescan is an alias from rescan-scsi-bus.sh. Use oprion -r to remove paths or devices

[root@fedora01 ~]# /usr/bin/rescan-scsi-bus.sh -a
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 
[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 

If rescan not working (for all linux and also Ubuntu) try:

[root@ubuntu ~]# ls /sys/class/scsi_host/host*/scan
[root@ubuntu ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@ubuntu ~]# echo "- - -" > /sys/class/scsi_host/host1/scan
for dev in $(ls /sys/class/scsi_host/host*/scan)
do
echo "- - -" > $dev
done

You can get the Fiber Channel addresses of the HBAs by typing the following commands:

# systool -c fc_host -v

Type the following command to determine the fibre channel target WWN:

# systool -c fc_transport -v

You will get node name (FC WWN) and port name of the storage processor port. Type the following command, to determine the mapping between SCSI HBTL addresses and the disks:

# sg_map -x
[root@fedora22 multipath]# dmsetup ls
fedora-swap	(253:0)
fedora-root	(253:1)
[root@fedora22 multipath]# dmsetup ls --tree
vgtest-lvmir (253:13)
 ├─vgtest-lvmir_mimage_1 (253:12)
 │  └─mpathep1 (253:8)
 │     └─mpathe (253:5)
 │        ├─ (8:112)
 │        └─ (8:64)
[root@fedora22 multipath]# lsscsi 
[0:0:1:0]    disk    AIX      VDASD            0001  /dev/sda 
[0:0:2:0]    cd/dvd  AIX      VOPTA                  /dev/sr0 
[root@fedora22 multipath]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   50G  0 disk 
├─sda1            8:1    0    4M  0 part 
├─sda2            8:2    0  500M  0 part /boot
└─sda3            8:3    0 49.5G  0 part 
  ├─fedora-swap 253:0    0    2G  0 lvm  [SWAP]
  └─fedora-root 253:1    0 47.5G  0 lvm  /
sr0              11:0    1 1024M  0 rom  

Remove a device

If you want to remove a device for example a disk /dev/mapper/mapthb, remove his multipath device using:

[root@fedora22 multipath]# dmsetup remove mpathb

Remove multipath devices

[root@fedora22 multipath]# rescan-scsi-bus.sh -r
linux/discover_devices.1609532704.txt.gz · Last modified: 2021/01/01 21:25 by 127.0.0.1