Using udev:
You can get useful information querying udev (on systems that use it - almost all desktop-type Linuxes for sure). For instance, if you want to know which attached drive is associated with /dev/sdb, you can use:
udevadm info --query=property --name=sdb
It will show you a list of properties of that device, including the serial (ID_SERIAL_SHORT). Having that information, you can look at the output of lsusb -v and find out things like the manufacturer and product name.
A shorter path to do this would be
udevadm info --query=property --name=sdb | grep "\(MODEL_ID\|VENDOR_ID\)"
and see the line with matching $ID_VENDOR_ID:$ID_MODEL_ID in the much shorter output of lsusb.
Another useful option is udevadm monitor. Use it if you'd like know which device node is created at the point of attaching the device. So first run
udevadm monitor --udev --subsystem-match=block
And then connect the device. You'll see the device names of the detected block devices (disks/partitions) printed at the end of each output line.
A practical example shell function:
Here's a function you can put in your .bashrc (or .zshrc) :
listusbdisks () { [[ "x$1" == "x-v" ]] && shift && local VERBOSE=-v for dsk in ${@-/dev/sd?} do /sbin/udevadm info --query=path --name="$dsk" | grep --colour=auto -q usb || continue echo "===== device $dsk is:" ( eval $(/sbin/udevadm info --query=property --name="$dsk" | grep "\(MODEL\|VENDOR\)_ID") [ "$ID_VENDOR_ID:$ID_MODEL_ID" == ":" ] && echo "Unknown" || \ lsusb $VERBOSE -d "$ID_VENDOR_ID:$ID_MODEL_ID" ) grep -q "$dsk" /proc/mounts && echo "----- DEVICE IS MOUNTED ----" echo done } Use it like this :
listusbdisks - to recognize all /dev/sdx devices; listusbdisks sdb or listusbdisks /dev/sdb or listusbdisks sdb sdc - to get info about certain devices only; listusbdisks -v [optional devices as above] - to show verbose outputs of lsusb
[Edit]: Added some functionality like querying many devices, checking mounts and control verbosity of lsusb.