i'm new on Linux May you help me?
I have connected disk on /dev/sda and another one on /dev/sdb
When i eject disk on /dev/sda and load & scanning (through echo "- - -" > /sys/class/scsi_host/host6/scan
) it again it's path becomes /dev/sdc but with the same disk serial id
Why physical disk connected to the same HBA port may have different paths like /dev/sda or /dev/sdc on Ubuntu, even if /dev/sda not in use?
You'll find that there's a brief period of time where a device path is not reused. Likely, if you eject the drive again, load it, and rescan the scsi bus, the drive will become /dev/sda. But, believe me, even when this order seems to stay the same, it's subject to change when you least expect it.
You'll see this repeated over and over again on this site and on forums across the internet: never rely on Linux's device path assignment.
Instead, when you must refer to a specific device, use the path generated by udev
in /dev/disk/by-id
or, sometimes, /dev/disk/by-path
. In /dev/disk/by-id
, you'll find symlinks from the drive's identifying information (vendor, model, and WWN) that stay the same from boot to boot, and don't rely on which HBA port they're plugged into:
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 ata-Samsung_SSD_850_PRO_512GB_S250NXAGB14452L -> ../../sdb
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 ata-Samsung_SSD_850_PRO_512GB_S250NXAGB14461T -> ../../sdd
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 ata-Samsung_SSD_850_PRO_512GB_S250NXAGB14444R -> ../../sde
If you need a HBA port representation, you can usually decode that from the entries in /dev/disk/by-path
, as here the SCSI host:bus:target:lun addressing shows up in the path:
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 pci-0000:00:1f.2-ata-1.0 -> ../../sda
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 pci-0000:05:00.0-scsi-0:0:8:0 -> ../../sdb
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 pci-0000:05:00.0-scsi-0:0:12:0 -> ../../sdd
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 pci-0000:05:00.0-scsi-0:0:15:0 -> ../../sde
lrwxrwxrwx. 1 root root 9 Sep 8 07:45 pci-0000:05:00.0-scsi-0:0:10:0 -> ../../sdc