Let's suppose you have two hard-disks:one internal (boots GNU/Linux (Debian));one external (USB).fdisk -l detects both, but will not tell you which is /dev/sda and which is /dev/sdb. lsusb will tell you there is an external USB device connected, but will not tell you whether it has been mapped to /dev/sda or /dev/sdb.How can you be get such information from your system?
GNU/Linux: how to detect hard disk mappings?
linux;debian;hard disk;devices
ls -l /sys/class/block/sd?The sd? entries are symbolic links that show how the disk is connected to the computer. There'll be a /usb in there for a USB disk.udevadm info -a -n sdaThis shows all the identifying information the kernel can get at directly for sda. You'll see how the disk is connected in more detail, e.g. going directly from SUBSYSTEMS==scsi to SUBSYSTEMS==pci, DRIVERS==ahci for a SATA disk on an Intel controller, or going from SUBSYSTEMS==scsi to SUBSYSTEMS==usb, DRIVERS==usb-storage for an USB disk.ls -l /dev/disk/by-*Under /dev/disk/by-*, you can locate disks by hardware attachment (by-path), by some globally unique identifier (by-uuid), by human-chosen label (by-label), or by manufacturer identification (by-id).