1

I have a U.2 SSD, which shows up as nvme1n1 in lsblk:

root@eris:~# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0  3.6T  0 disk 
├─nvme0n1p1 259:1    0  476M  0 part /boot/efi
├─nvme0n1p2 259:2    0 38.1G  0 part /
└─nvme0n1p3 259:3    0  3.6T  0 part /data
nvme1n1     259:4    0  3.5T  0 disk 

Looking in dmesg, I can see that:

root@eris:~# dmesg | grep -i nvme
[    0.997417] nvme nvme0: pci function 0000:01:00.0
[    0.997448] nvme nvme1: pci function 0000:04:00.0
...

And this matches:

root@eris:~# ll /sys/bus/pci/drivers/nvme | grep 04:00.0
lrwxrwxrwx 1 root root    0 Jul  4 14:41 0000:04:00.0 -> ../../../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:02.0/0000:04:00.0

Which is something I will need to know for later.

My question is, is there a simpler way to get from /dev/nvme1n1 to /sys/bus/pci/drivers/nvme/0000:04:00.0?

1 Answer 1

5

Yeah,

ls -la /dev/disk/by-path

# or
cd /sys/block
for i in nvme*; do
    echo "$i is `cat $i/device/address`"
done
1
  • That's brilliant! Thx!
    – j4nd3r53n
    Commented Jul 4, 2022 at 15:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .