How can I list scsi device ids under Linux?
- 3Please take my previous comment about how to ask good questions seriously! Drop the "hi" and "thanks", make sure the first few lines or the question introduce the question instead of being meta data so that the home page summaries are useful, and always show what attempts you have made to solve problems yourself. I answered this question by copy and pasting a bit of it into google and copy and pasting a bit from the result summaries back to you (after checking it in my terminal).Caleb– Caleb2011-06-17 11:04:31 +00:00Commented Jun 17, 2011 at 11:04
- SCSI ID is not precisely defined thing, reference this discussion yarchive.net/comp/linux/scsi_ids.htmlcatpnosis– catpnosis2016-01-30 17:55:08 +00:00Commented Jan 30, 2016 at 17:55
Add a comment |
3 Answers
I don't have /proc/scsi/scsi on my system with 2.6.39.1 kernel. I would use 'lsscsi' command:
~> lsscsi -v [0:0:0:0] disk ATA ST3500418AS CC38 /dev/sda dir: /sys/bus/scsi/devices/0:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0] [1:0:0:0] disk ATA WDC WD2500KS-00M 02.0 /dev/sdb dir: /sys/bus/scsi/devices/1:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0] - 2.6.38.6 here and I do have it. I wonder if there is a kernel config option for providing that interface. The reference I found to using that proc entry was as old as the hills. Also my distro doesn't have
lsscsiby default although I see there is an optional package for it.Caleb– Caleb2011-06-17 19:01:38 +00:00Commented Jun 17, 2011 at 19:01 - 8To add, modern
lsblk -Scan show HOST:CHANNEL:TARGET:LUN numbers too.catpnosis– catpnosis2016-01-30 17:46:32 +00:00Commented Jan 30, 2016 at 17:46
cat /proc/scsi/scsi - 1This does not show which SCSI ids correspond to which system devices.catpnosis– catpnosis2016-01-30 17:04:59 +00:00Commented Jan 30, 2016 at 17:04
- Also it doesn't exist any more.Matthias Urlichs– Matthias Urlichs2021-10-22 12:58:47 +00:00Commented Oct 22, 2021 at 12:58
- @MatthiasUrlichs does exist for me on
5.18.6-zen1-1-zen. Perhaps you kernel has some setting disabled that creates that dir.Hi-Angel– Hi-Angel2022-07-20 08:42:51 +00:00Commented Jul 20, 2022 at 8:42
You can use the links in /dev/disk/by-id:
[root@krxl02cn05 by-id]# pwd /dev/disk/by-id [root@krxl02cn05 by-id]# ls -rtl total 0 lrwxrwxrwx 1 root root 9 Feb 12 01:40 scsi-3600605b005d8655019aa31faf0812bae -> ../../sda lrwxrwxrwx 1 root root 10 Feb 12 01:40 scsi-3600605b005d8655019aa31faf0812bae-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Feb 12 01:40 scsi-3600605b005d8655019aa31faf0812bae-part1 -> ../../sda1 lrwxrwxrwx 1 root root 9 Feb 12 01:50 scsi-3600144f09a214698000054db88550008 -> ../../sdd lrwxrwxrwx 1 root root 9 Feb 12 01:50 scsi-3600144f09a214698000054db88460007 -> ../../sdc lrwxrwxrwx 1 root root 9 Feb 12 01:50 scsi-3600144f09a214698000054db88260006 -> ../../sdb lrwxrwxrwx 1 root root 10 Feb 12 01:54 scsi-3600144f09a214698000054db88260006-part1 -> ../../sdb1 lrwxrwxrwx 1 root root 15 Feb 12 04:56 scsi-3600144f09a214698000054db88460007-part1 -> ../../asm-disk1 lrwxrwxrwx 1 root root 15 Feb 12 04:59 scsi-3600144f09a214698000054db88550008-part1 -> ../../asm-disk2 So, the scsi id of /dev/sdc is 3600144f09a214698000054db88460007
- 1Incorrectly downvoted answer.
by-idshows WWID which is valid SCSI identificator, even thoughby-idnot necessarily shows all disks. Sometimes,/dev/disk/by-pathcan show SCSI Ids too. Examplels -l /dev/disk/by-pathoutputspci-0000:00:07.1-scsi-1:0:0:0 -> ../../sr0. So,sr0have SCSI Host:BUS:Target_ID:LUN1:0:0:0. This is not SCSI disk, though.catpnosis– catpnosis2016-01-30 17:35:51 +00:00Commented Jan 30, 2016 at 17:35 - Actually,
lsscsi --scsi_idshowsscsi-*matching id from/dev/disk/by-id(if present).catpnosis– catpnosis2016-01-30 17:42:13 +00:00Commented Jan 30, 2016 at 17:42