[This is on Debian 12]
To fully access my DVD drive, I need to also know its SCSI generic path (/dev/sgX) in addition to its expected CDROM-/dev/srX path.
The specific device is important, though, and I need to access the device even if the system re-shuffles the /dev/srXs and /dev/sgXs.
sudo lsscsi -g [3:0:0:0] cd/dvd HL-DT-ST BD-RE WH16NS60 1.05 /dev/sr0 /dev/sg3 sudo blkid /dev/sr0 /dev/sr0: UUID="035bbeef20202020" LABEL="WALDEINSAMKEIT" BLOCK_SIZE="2048" TYPE="udf" sudo blkid /dev/sg3 <no output> /dev/sr0 is set with a /dev/disk/by-uuid/035bbeef20202020 but if /dev/sg3 doesn't actually have a UUID (I'm guessing it's not seen as a block device), I could go for the full controller/system path, per this Linus rant I found https://yarchive.net/comp/linux/scsi_ids.html
sudo udevadm info -q path -n /dev/sr0 /devices/pci0000:00/0000:00:17.0/ata4/host3/target3:0:0/3:0:0:0/block/sr0 sudo udevadm info -q path -n /dev/sg3 /devices/pci0000:00/0000:00:17.0/ata4/host3/target3:0:0/3:0:0:0/scsi_generic/sg3 This does not seem like a solution either, as the path includes sr0 or sg3 which will change order. /sys/devices/pci0000:00/0000:00:17.0/ata4/host3/target3:0:0/3:0:0:0 seems to be a directory the device is referencing but I can't find anything more than the folders block/sr0 and scsi_generic/sg3 which again revert to the original problem of sr0 and sg3 changing if the system cables are reordered or something.
How can I get a consistent identifier for /dev/sg3? I have searched hard, but I must be missing a command.
/devices/pci0000:00/0000:00:17.0/ata4/host3/target3:0:0/3:0:0:0/block/nor in/devices/pci0000:00/0000:00:17.0/ata4/host3/target3:0:0/3:0:0:0/scsi_generic/. Can you check that there's really more than one device in there that you could mistake for the right one?/devices/pci0000:00/0000:00:17.0/ata4/host3/target3:0:0/3:0:0:0/scsi_generic/sg3is more that it would change tosg2and then wherever I have the call forsg3would not work. As a pro, you are right it does avoid another device being accessed as/dev/sg3inadvertently, but it doesn't provide the reliability/dev/disk/by-uuid/035bbeef20202020does - which is what I'm hoping for.035bbeef20202020is not associated with the drive, but with the currently inserted disc. A DVD drive with no disc inserted has no UUID at all.