Suppose in a linux machine you have both SATA and USB devices present, and if they are all detected properly, how do you know whether a specific device(sda1/ sdb1) is USB device OR SATA device.
Note: devices needs to be manually mounted.
Note: dmesg is cleared already. we cannot use /var/log/messages as that too is cleared.
Question is : Is there other way, say from /proc or any other command by which we know that the specific device(sda1/sdb1) is SATA OR USB ?
Thanks!
Best Answer
You can get that information from
/sys
virtual file system.Run
find /sys -name \*sd[ab]\*
. Some of the lines from my station are:There is "usb" in the line with sdb, there's none in the line with sda, so the USB drive is sdb.
Another piece of information that you can get is from
files. If file's contents is 0, then the device isn't removable, so it cannot be an external USB drive. Some SATA drives report themselves as removable, so it may not be definitive.