RTFM

[Read This Fine Material] from Joshua Hoblitt

Die SCSI device, Die!

| 0 comments

It appears that under some circumstances these two sysfs trees /sys/bus/scsi/drivers/sd/ & /sys/bus/scsi/devices/ may not be populated with the same set of devices.

There are a lot of SCSI devices/LUNs visible on this system from a SAN it was previously connected to. It’s a shame to have to reboot a system just to clear absent block devices so we’re going to have to manually delete them.

Note the -s for the block device path. It seems that some LUNs that were visible on the SAN never had a block device/driver attached to them (or since had it removed). I’ve now decommissioned that old SAN system so I can’t try to reproduce it.

[root@foo3 ~]# lsscsi
[0:0:0:0]    disk    ATA      ST3250310NS      SN06  /dev/sda
[1:0:0:0]    disk    ATA      ST31000340NS     SN06  /dev/sdb
[2:0:0:0]    disk    ATA      Hitachi HUA72202 JKAO  /dev/sdc
[3:0:0:0]    disk    ATA      Hitachi HUA72202 JKAO  /dev/sdd
[4:0:0:0]    cd/dvd  TEAC     DV-28S-V         1.0B  /dev/scd0
[6:0:0:0]    disk    Promise  VTrak E610f      1006  /dev/sde
[6:0:1:0]    disk    Promise  VTrak E610f      1006  /dev/sdf
[6:0:2:0]    storage Promise  VTrak E610f      1006  -       
[6:0:2:1]    disk    Promise  VTrak E610f      1006  /dev/sdg
[6:0:3:0]    storage Promise  VTrak E610f      1006  -       
[6:0:3:1]    disk    Promise  VTrak E610f      1006  /dev/sdh
[6:0:4:0]    disk    Promise  VTrak E610f      1006  /dev/sdi
[6:0:5:0]    disk    Promise  VTrak E610f      1006  /dev/sdj
[6:0:6:0]    storage Promise  VTrak E610f      1006  -       
[6:0:6:1]    disk    Promise  VTrak E610f      1006  /dev/sdk
[6:0:7:0]    storage Promise  VTrak E610f      1006  -       
[6:0:7:1]    disk    Promise  VTrak E610f      1006  /dev/sdl
[6:0:8:0]    disk    APPLE    Xserve RAID      1.50  /dev/sdu
[6:0:9:0]    disk    Promise  VTrak E610f      1006  /dev/sdv
[6:0:9:2]    disk    Promise  VTrak E610f      1006  /dev/sdw
[6:0:10:0]   disk    Promise  VTrak E610f      1006  /dev/sdx
[6:0:10:2]   disk    Promise  VTrak E610f      1006  /dev/sdy
[6:0:11:0]   storage Promise  VTrak E610f      1006  -       
[6:0:11:1]   disk    Promise  VTrak E610f      1006  /dev/sdz
[6:0:12:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdaa
[6:0:13:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdab
[6:0:14:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdac
[6:0:15:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdad
[6:0:16:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdae
[6:0:17:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdag
[6:0:18:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdah
[6:0:19:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdak
[6:0:20:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdal
[6:0:21:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdan
[6:0:22:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdao
[6:0:23:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdaq
[6:0:24:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdas
[6:0:25:0]   storage Promise  VTrak E610f      1006  -       
[6:0:25:1]   disk    Promise  VTrak E610f      1006  /dev/sdau
[6:0:26:0]   disk    Promise  VTrak E610f      1006  /dev/sdav
[6:0:26:2]   disk    Promise  VTrak E610f      1006  /dev/sdaw
[6:0:27:0]   disk    Promise  VTrak E610f      1006  /dev/sday
[6:0:27:2]   disk    Promise  VTrak E610f      1006  /dev/sdaz
[6:0:28:0]   disk    Promise  VTrak E610f      1006  /dev/sdba
[6:0:29:0]   disk    Promise  VTrak E610f      1006  /dev/sdbb
[6:0:30:0]   storage Promise  VTrak E610f      1006  -       
[6:0:30:1]   disk    Promise  VTrak E610f      1006  /dev/sdbd
[6:0:31:0]   storage Promise  VTrak E610f      1006  -       
[6:0:31:1]   disk    Promise  VTrak E610f      1006  /dev/sdbf
[6:0:32:0]   storage Promise  VTrak E610f      1006  -       
[6:0:32:1]   disk    Promise  VTrak E610f      1006  /dev/sdbi
[6:0:33:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdbj
[6:0:34:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdbp
[6:0:35:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdbv
[6:0:36:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdbz
[6:0:37:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdcc
[6:0:38:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdch
[6:0:39:0]   storage Promise  VTrak E610f      1006  -       
[6:0:39:1]   disk    Promise  VTrak E610f      1006  /dev/sdck
[6:0:39:3]   disk    Promise  VTrak E610f      1006  /dev/sdcl
[6:0:40:0]   storage Promise  VTrak E610f      1006  -       
[6:0:40:1]   disk    Promise  VTrak E610f      1006  /dev/sdcm
[6:0:40:3]   disk    Promise  VTrak E610f      1006  /dev/sdco
[6:0:41:0]   disk    Promise  VTrak E610f      1006  /dev/sdcp
[6:0:42:0]   disk    Promise  VTrak E610f      1006  /dev/sdcr
[6:0:43:0]   storage Promise  VTrak E610f      1006  -       
[6:0:43:1]   disk    Promise  VTrak E610f      1006  /dev/sdcs
[7:0:0:0]    disk    Promise  VTrak E610f      1006  /dev/sdm
[7:0:1:0]    disk    Promise  VTrak E610f      1006  /dev/sdn
[7:0:2:0]    storage Promise  VTrak E610f      1006  -       
[7:0:2:1]    disk    Promise  VTrak E610f      1006  /dev/sdo
[7:0:3:0]    storage Promise  VTrak E610f      1006  -       
[7:0:3:1]    disk    Promise  VTrak E610f      1006  /dev/sdp
[7:0:4:0]    disk    Promise  VTrak E610f      1006  /dev/sdq
[7:0:5:0]    disk    Promise  VTrak E610f      1006  /dev/sdr
[7:0:6:0]    storage Promise  VTrak E610f      1006  -       
[7:0:6:1]    disk    Promise  VTrak E610f      1006  /dev/sds
[7:0:7:0]    storage Promise  VTrak E610f      1006  -       
[7:0:7:1]    disk    Promise  VTrak E610f      1006  /dev/sdt
[7:0:8:0]    disk    APPLE    Xserve RAID      1.50  /dev/sdaf
[7:0:9:0]    disk    APPLE    Xserve RAID      1.50  /dev/sdai
[7:0:10:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdaj
[7:0:11:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdam
[7:0:12:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdap
[7:0:13:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdar
[7:0:14:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdat
[7:0:15:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdax
[7:0:16:0]   disk    Promise  VTrak E610f      1006  /dev/sdbc
[7:0:16:2]   disk    Promise  VTrak E610f      1006  /dev/sdbe
[7:0:17:0]   disk    Promise  VTrak E610f      1006  /dev/sdbg
[7:0:17:2]   disk    Promise  VTrak E610f      1006  /dev/sdbh
[7:0:18:0]   storage Promise  VTrak E610f      1006  -       
[7:0:18:1]   disk    Promise  VTrak E610f      1006  /dev/sdbk
[7:0:19:0]   disk    Promise  VTrak E610f      1006  /dev/sdbl
[7:0:19:2]   disk    Promise  VTrak E610f      1006  /dev/sdbm
[7:0:20:0]   disk    Promise  VTrak E610f      1006  /dev/sdbn
[7:0:20:2]   disk    Promise  VTrak E610f      1006  /dev/sdbo
[7:0:21:0]   storage Promise  VTrak E610f      1006  -       
[7:0:21:1]   disk    Promise  VTrak E610f      1006  /dev/sdbq
[7:0:22:0]   disk    Promise  VTrak E610f      1006  /dev/sdbr
[7:0:23:0]   storage Promise  VTrak E610f      1006  -       
[7:0:23:1]   disk    Promise  VTrak E610f      1006  /dev/sdbs
[7:0:24:0]   storage Promise  VTrak E610f      1006  -       
[7:0:24:1]   disk    Promise  VTrak E610f      1006  /dev/sdbt
[7:0:25:0]   storage Promise  VTrak E610f      1006  -       
[7:0:25:1]   disk    Promise  VTrak E610f      1006  /dev/sdbu
[7:0:25:3]   disk    Promise  VTrak E610f      1006  /dev/sdbw
[7:0:26:0]   storage Promise  VTrak E610f      1006  -       
[7:0:26:1]   disk    Promise  VTrak E610f      1006  /dev/sdbx
[7:0:26:3]   disk    Promise  VTrak E610f      1006  /dev/sdby
[7:0:27:0]   disk    Promise  VTrak E610f      1006  /dev/sdca
[7:0:28:0]   disk    Promise  VTrak E610f      1006  /dev/sdcb
[7:0:29:0]   storage Promise  VTrak E610f      1006  -       
[7:0:29:1]   disk    Promise  VTrak E610f      1006  /dev/sdcd
[7:0:30:0]   storage Promise  VTrak E610f      1006  -       
[7:0:30:1]   disk    Promise  VTrak E610f      1006  /dev/sdce
[7:0:31:0]   disk    Promise  VTrak E610f      1006  /dev/sdcf
[7:0:32:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdcg
[7:0:33:0]   disk    APPLE    Xserve RAID      1.51  /dev/sdci
[7:0:34:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdcj
[7:0:35:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdcn
[7:0:36:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdcq
[7:0:37:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdct
[7:0:38:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdcu
[7:0:39:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdcv
[7:0:40:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdcw
[7:0:41:0]   disk    APPLE    Xserve RAID      1.26  /dev/sdcx
[7:0:42:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdcy
[7:0:43:0]   disk    APPLE    Xserve RAID      1.50  /dev/sdcz

Instead of deleting each device one by one we’re going to use a one liner.

[root@foo3 ~]# find  /sys/bus/scsi/drivers/sd/[67]* | perl -pe 's|^|echo 1 > |; s|:|\\:|g; s|$|/delete|'
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:0\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:1\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:10\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:10\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:11\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:12\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:13\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:14\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:15\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:16\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:17\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:18\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:19\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:20\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:2\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:21\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:22\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:23\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:24\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:25\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:26\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:26\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:27\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:27\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:28\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:29\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:30\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:3\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:31\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:32\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:33\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:34\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:35\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:36\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:37\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:38\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:39\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:39\:3/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:4\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:40\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:40\:3/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:41\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:42\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:43\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:5\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:6\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:7\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:8\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:9\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:9\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:0\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:1\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:10\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:11\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:12\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:13\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:14\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:15\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:16\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:16\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:17\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:17\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:18\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:19\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:19\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:20\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:20\:2/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:2\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:21\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:22\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:23\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:24\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:25\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:25\:3/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:26\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:26\:3/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:27\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:28\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:29\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:30\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:3\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:31\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:32\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:33\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:34\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:35\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:36\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:37\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:38\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:39\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:4\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:40\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:41\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:42\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:5\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:6\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:7\:1/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:8\:0/delete
echo 1 > /sys/bus/scsi/drivers/sd/7\:0\:9\:0/delete

Now apply that oneliner…

[root@foo3 ~]# find  /sys/bus/scsi/drivers/sd/[67]* | perl -pe 's|^|echo 1 > |; s|:|\\:|g; s|$|/delete|' | bash
[root@foo3 ~]# lsscsi
[0:0:0:0]    disk    ATA      ST3250310NS      SN06  /dev/sda
[1:0:0:0]    disk    ATA      ST31000340NS     SN06  /dev/sdb
[2:0:0:0]    disk    ATA      Hitachi HUA72202 JKAO  /dev/sdc
[3:0:0:0]    disk    ATA      Hitachi HUA72202 JKAO  /dev/sdd
[4:0:0:0]    cd/dvd  TEAC     DV-28S-V         1.0B  /dev/scd0
[6:0:2:0]    storage Promise  VTrak E610f      1006  -       
[6:0:3:0]    storage Promise  VTrak E610f      1006  -       
[6:0:6:0]    storage Promise  VTrak E610f      1006  -       
[6:0:7:0]    storage Promise  VTrak E610f      1006  -       
[6:0:11:0]   storage Promise  VTrak E610f      1006  -       
[6:0:25:0]   storage Promise  VTrak E610f      1006  -       
[6:0:30:0]   storage Promise  VTrak E610f      1006  -       
[6:0:31:0]   storage Promise  VTrak E610f      1006  -       
[6:0:32:0]   storage Promise  VTrak E610f      1006  -       
[6:0:39:0]   storage Promise  VTrak E610f      1006  -       
[6:0:40:0]   storage Promise  VTrak E610f      1006  -       
[6:0:43:0]   storage Promise  VTrak E610f      1006  -       
[7:0:2:0]    storage Promise  VTrak E610f      1006  -       
[7:0:3:0]    storage Promise  VTrak E610f      1006  -       
[7:0:6:0]    storage Promise  VTrak E610f      1006  -       
[7:0:7:0]    storage Promise  VTrak E610f      1006  -       
[7:0:18:0]   storage Promise  VTrak E610f      1006  -       
[7:0:21:0]   storage Promise  VTrak E610f      1006  -       
[7:0:23:0]   storage Promise  VTrak E610f      1006  -       
[7:0:24:0]   storage Promise  VTrak E610f      1006  -       
[7:0:25:0]   storage Promise  VTrak E610f      1006  -       
[7:0:26:0]   storage Promise  VTrak E610f      1006  -       
[7:0:29:0]   storage Promise  VTrak E610f      1006  -       
[7:0:30:0]   storage Promise  VTrak E610f      1006  -    
[root@foo3 ~]# find  /sys/bus/scsi/drivers/sd/
/sys/bus/scsi/drivers/sd/
/sys/bus/scsi/drivers/sd/3:0:0:0
/sys/bus/scsi/drivers/sd/2:0:0:0
/sys/bus/scsi/drivers/sd/1:0:0:0
/sys/bus/scsi/drivers/sd/0:0:0:0
/sys/bus/scsi/drivers/sd/bind
/sys/bus/scsi/drivers/sd/unbind

WTH! This had me scratching my head for a while. If you check carefully with the list above you’ll see that the first one liner only removed the LUNs with block devices attached to them.

[root@foo3 ~]# tree /sys/bus/scsi/devices/
/sys/bus/scsi/devices/
|-- 0:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0
|-- 1:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0
|-- 2:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0
|-- 3:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0
|-- 4:0:0:0 -> ../../../devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0
|-- 6:0:11:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-11/target6:0:11/6:0:11:0
|-- 6:0:25:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-25/target6:0:25/6:0:25:0
|-- 6:0:2:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-2/target6:0:2/6:0:2:0
|-- 6:0:30:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-30/target6:0:30/6:0:30:0
|-- 6:0:31:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-31/target6:0:31/6:0:31:0
|-- 6:0:32:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-32/target6:0:32/6:0:32:0
|-- 6:0:39:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-39/target6:0:39/6:0:39:0
|-- 6:0:3:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-3/target6:0:3/6:0:3:0
|-- 6:0:40:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-40/target6:0:40/6:0:40:0
|-- 6:0:43:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-43/target6:0:43/6:0:43:0
|-- 6:0:6:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-6/target6:0:6/6:0:6:0
|-- 6:0:7:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.0/host6/rport-6:0-7/target6:0:7/6:0:7:0
|-- 7:0:18:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-18/target7:0:18/7:0:18:0
|-- 7:0:21:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-21/target7:0:21/7:0:21:0
|-- 7:0:23:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-23/target7:0:23/7:0:23:0
|-- 7:0:24:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-24/target7:0:24/7:0:24:0
|-- 7:0:25:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-25/target7:0:25/7:0:25:0
|-- 7:0:26:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-26/target7:0:26/7:0:26:0
|-- 7:0:29:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-29/target7:0:29/7:0:29:0
|-- 7:0:2:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-2/target7:0:2/7:0:2:0
|-- 7:0:30:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-30/target7:0:30/7:0:30:0
|-- 7:0:3:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-3/target7:0:3/7:0:3:0
|-- 7:0:6:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-6/target7:0:6/7:0:6:0
`-- 7:0:7:0 -> ../../../devices/pci0000:00/0000:00:07.0/0000:04:00.1/host7/rport-7:0-7/target7:0:7/7:0:7:0

So lets try that again.

[root@foo3 ~]# find  /sys/bus/scsi/devices/[67]* | perl -pe 's|^|echo 1 > |; s|:|\\:|g; s|$|/delete|' | bash
[root@foo3 ~]# lsscsi
[0:0:0:0]    disk    ATA      ST3250310NS      SN06  /dev/sda
[1:0:0:0]    disk    ATA      ST31000340NS     SN06  /dev/sdb
[2:0:0:0]    disk    ATA      Hitachi HUA72202 JKAO  /dev/sdc
[3:0:0:0]    disk    ATA      Hitachi HUA72202 JKAO  /dev/sdd
[4:0:0:0]    cd/dvd  TEAC     DV-28S-V         1.0B  /dev/scd0
[root@foo3 ~]# cat /proc/partitions 
major minor  #blocks  name

   8     0  244198584 sda
   8     1     514048 sda1
   8     2   36861142 sda2
   8     3   16386300 sda3
   8     4          1 sda4
   8     5   12289693 sda5
   8     6    2096451 sda6
   8     7    1020096 sda7
   8     8  175028143 sda8
   8    16  976762584 sdb
   8    17  976760001 sdb1
   8    32 1953514584 sdc
   8    48 1953514584 sdd

And we’re now completely rid of the old SAN LUNs.

Leave a Reply