How do I get from /dev/sdi to /dev/disk/by-id?

How do I find that /dev/disk/by-id/ata-Samsung_SSD_980_1TB_S64ANS0W304164P is actually /dev/sdi?

I want a single command;)

, cause I know I can do this:

1. mount a partition
2. udevadm info --device-id-of-file /mnt/sdi3
3. find the device in udevadm info --export-db

I want something like

what-dev-id /dev/sdi

, then it prints out the /dev/disk/by-id;)

ls -l /dev/disk/by-id/ata-Samsung_SSD_980_1TB_S64ANS0W304164P ?


readlink -f /dev/disk/by-id/ata-Samsung_SSD_980_1TB_S64ANS0W304164P

No, that’s from /dev/disk/by-id to /dev/sdi

I’m talking about the other way around.

I see. IMHO the first sentence of the OP reads as the other direction. It might be good, to rephrase it to help other understand the issue.

lsblk -o +ID will add the ID to a column of the normal lsblk output.

1 Like