Is there a way to figure out what physical port a drive is being inserted into through linux?












2















Without knowing the order of which drives are being inserted and which ports they are being inserted (by human eye), is there a way to tell where they are being inserted using linux commands? I need this to be able to create a web design showing placement of ports & status etc.










share|improve this question























  • if you are asking about network ports this might be helpful unix.stackexchange.com/questions/474479/…

    – BlackCrystal
    Jan 30 at 7:17
















2















Without knowing the order of which drives are being inserted and which ports they are being inserted (by human eye), is there a way to tell where they are being inserted using linux commands? I need this to be able to create a web design showing placement of ports & status etc.










share|improve this question























  • if you are asking about network ports this might be helpful unix.stackexchange.com/questions/474479/…

    – BlackCrystal
    Jan 30 at 7:17














2












2








2








Without knowing the order of which drives are being inserted and which ports they are being inserted (by human eye), is there a way to tell where they are being inserted using linux commands? I need this to be able to create a web design showing placement of ports & status etc.










share|improve this question














Without knowing the order of which drives are being inserted and which ports they are being inserted (by human eye), is there a way to tell where they are being inserted using linux commands? I need this to be able to create a web design showing placement of ports & status etc.







linux linux-kernel partition usb-drive port






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 30 at 5:03









kenedykenedy

282




282













  • if you are asking about network ports this might be helpful unix.stackexchange.com/questions/474479/…

    – BlackCrystal
    Jan 30 at 7:17



















  • if you are asking about network ports this might be helpful unix.stackexchange.com/questions/474479/…

    – BlackCrystal
    Jan 30 at 7:17

















if you are asking about network ports this might be helpful unix.stackexchange.com/questions/474479/…

– BlackCrystal
Jan 30 at 7:17





if you are asking about network ports this might be helpful unix.stackexchange.com/questions/474479/…

– BlackCrystal
Jan 30 at 7:17










1 Answer
1






active

oldest

votes


















2














Yes you can. lsusb will give you details at the Bus and Device level and with fdisk -l it is possible to view which 'USB drives' are mapped into what devices. You can also look at the dmesg outputs to see the port in which your 'USB' has been plugged in. You may have to constantly checking the output.



For example:



>> lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 04f2:b2db Chicony Electronics Co., Ltd
Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]
Bus 001 Device 003: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 1058:07a8 Western Digital Technologies, Inc. My Passport (WDBBEP), My Passport for Mac (WDBLUZ)
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


My external drive has been plugged in to my USB3.0 port.



Device         Start       End   Sectors   Size Type
/dev/sda1 2048 411647 409600 200M BIOS boot
/dev/sda2 411648 126240767 125829120 60G Linux root (x86-64)
/dev/sda3 126240768 143017983 16777216 8G Linux swap
/dev/sda4 143017984 976773127 833755144 397.6G Linux root (x86-64)

Disk /dev/sdb: 931.5 GiB, 1000170586112 bytes, 1953458176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00023f15

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953458175 1953456128 931.5G 7 HPFS/NTFS/exFAT


In the above, my external drive is /dev/sdb1.






share|improve this answer


























  • If you have multiple devices connected then what are the defining numbers/pieces of information that links what you get into lsusb and fdisk -l ? or do you just have to search through by insertion order?

    – kenedy
    Jan 30 at 12:54











  • going off that I guess what is the determining line or piece of info within lsusb that makes it usb3?

    – kenedy
    Jan 30 at 12:59











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f497607%2fis-there-a-way-to-figure-out-what-physical-port-a-drive-is-being-inserted-into-t%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Yes you can. lsusb will give you details at the Bus and Device level and with fdisk -l it is possible to view which 'USB drives' are mapped into what devices. You can also look at the dmesg outputs to see the port in which your 'USB' has been plugged in. You may have to constantly checking the output.



For example:



>> lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 04f2:b2db Chicony Electronics Co., Ltd
Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]
Bus 001 Device 003: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 1058:07a8 Western Digital Technologies, Inc. My Passport (WDBBEP), My Passport for Mac (WDBLUZ)
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


My external drive has been plugged in to my USB3.0 port.



Device         Start       End   Sectors   Size Type
/dev/sda1 2048 411647 409600 200M BIOS boot
/dev/sda2 411648 126240767 125829120 60G Linux root (x86-64)
/dev/sda3 126240768 143017983 16777216 8G Linux swap
/dev/sda4 143017984 976773127 833755144 397.6G Linux root (x86-64)

Disk /dev/sdb: 931.5 GiB, 1000170586112 bytes, 1953458176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00023f15

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953458175 1953456128 931.5G 7 HPFS/NTFS/exFAT


In the above, my external drive is /dev/sdb1.






share|improve this answer


























  • If you have multiple devices connected then what are the defining numbers/pieces of information that links what you get into lsusb and fdisk -l ? or do you just have to search through by insertion order?

    – kenedy
    Jan 30 at 12:54











  • going off that I guess what is the determining line or piece of info within lsusb that makes it usb3?

    – kenedy
    Jan 30 at 12:59
















2














Yes you can. lsusb will give you details at the Bus and Device level and with fdisk -l it is possible to view which 'USB drives' are mapped into what devices. You can also look at the dmesg outputs to see the port in which your 'USB' has been plugged in. You may have to constantly checking the output.



For example:



>> lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 04f2:b2db Chicony Electronics Co., Ltd
Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]
Bus 001 Device 003: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 1058:07a8 Western Digital Technologies, Inc. My Passport (WDBBEP), My Passport for Mac (WDBLUZ)
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


My external drive has been plugged in to my USB3.0 port.



Device         Start       End   Sectors   Size Type
/dev/sda1 2048 411647 409600 200M BIOS boot
/dev/sda2 411648 126240767 125829120 60G Linux root (x86-64)
/dev/sda3 126240768 143017983 16777216 8G Linux swap
/dev/sda4 143017984 976773127 833755144 397.6G Linux root (x86-64)

Disk /dev/sdb: 931.5 GiB, 1000170586112 bytes, 1953458176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00023f15

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953458175 1953456128 931.5G 7 HPFS/NTFS/exFAT


In the above, my external drive is /dev/sdb1.






share|improve this answer


























  • If you have multiple devices connected then what are the defining numbers/pieces of information that links what you get into lsusb and fdisk -l ? or do you just have to search through by insertion order?

    – kenedy
    Jan 30 at 12:54











  • going off that I guess what is the determining line or piece of info within lsusb that makes it usb3?

    – kenedy
    Jan 30 at 12:59














2












2








2







Yes you can. lsusb will give you details at the Bus and Device level and with fdisk -l it is possible to view which 'USB drives' are mapped into what devices. You can also look at the dmesg outputs to see the port in which your 'USB' has been plugged in. You may have to constantly checking the output.



For example:



>> lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 04f2:b2db Chicony Electronics Co., Ltd
Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]
Bus 001 Device 003: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 1058:07a8 Western Digital Technologies, Inc. My Passport (WDBBEP), My Passport for Mac (WDBLUZ)
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


My external drive has been plugged in to my USB3.0 port.



Device         Start       End   Sectors   Size Type
/dev/sda1 2048 411647 409600 200M BIOS boot
/dev/sda2 411648 126240767 125829120 60G Linux root (x86-64)
/dev/sda3 126240768 143017983 16777216 8G Linux swap
/dev/sda4 143017984 976773127 833755144 397.6G Linux root (x86-64)

Disk /dev/sdb: 931.5 GiB, 1000170586112 bytes, 1953458176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00023f15

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953458175 1953456128 931.5G 7 HPFS/NTFS/exFAT


In the above, my external drive is /dev/sdb1.






share|improve this answer















Yes you can. lsusb will give you details at the Bus and Device level and with fdisk -l it is possible to view which 'USB drives' are mapped into what devices. You can also look at the dmesg outputs to see the port in which your 'USB' has been plugged in. You may have to constantly checking the output.



For example:



>> lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 04f2:b2db Chicony Electronics Co., Ltd
Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]
Bus 001 Device 003: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 1058:07a8 Western Digital Technologies, Inc. My Passport (WDBBEP), My Passport for Mac (WDBLUZ)
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


My external drive has been plugged in to my USB3.0 port.



Device         Start       End   Sectors   Size Type
/dev/sda1 2048 411647 409600 200M BIOS boot
/dev/sda2 411648 126240767 125829120 60G Linux root (x86-64)
/dev/sda3 126240768 143017983 16777216 8G Linux swap
/dev/sda4 143017984 976773127 833755144 397.6G Linux root (x86-64)

Disk /dev/sdb: 931.5 GiB, 1000170586112 bytes, 1953458176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00023f15

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953458175 1953456128 931.5G 7 HPFS/NTFS/exFAT


In the above, my external drive is /dev/sdb1.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 30 at 5:57

























answered Jan 30 at 5:50









RussellBRussellB

251211




251211













  • If you have multiple devices connected then what are the defining numbers/pieces of information that links what you get into lsusb and fdisk -l ? or do you just have to search through by insertion order?

    – kenedy
    Jan 30 at 12:54











  • going off that I guess what is the determining line or piece of info within lsusb that makes it usb3?

    – kenedy
    Jan 30 at 12:59



















  • If you have multiple devices connected then what are the defining numbers/pieces of information that links what you get into lsusb and fdisk -l ? or do you just have to search through by insertion order?

    – kenedy
    Jan 30 at 12:54











  • going off that I guess what is the determining line or piece of info within lsusb that makes it usb3?

    – kenedy
    Jan 30 at 12:59

















If you have multiple devices connected then what are the defining numbers/pieces of information that links what you get into lsusb and fdisk -l ? or do you just have to search through by insertion order?

– kenedy
Jan 30 at 12:54





If you have multiple devices connected then what are the defining numbers/pieces of information that links what you get into lsusb and fdisk -l ? or do you just have to search through by insertion order?

– kenedy
Jan 30 at 12:54













going off that I guess what is the determining line or piece of info within lsusb that makes it usb3?

– kenedy
Jan 30 at 12:59





going off that I guess what is the determining line or piece of info within lsusb that makes it usb3?

– kenedy
Jan 30 at 12:59


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f497607%2fis-there-a-way-to-figure-out-what-physical-port-a-drive-is-being-inserted-into-t%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?