Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to distinguish between the Internal Hard drives and External Hard drives.

Actually i need to see how many External hardrives do we have and to which server are they connected .

This is the Screenshot i took and by judging by its name SDE is external hard drive. But im not sure .

So help me out.

enter image description here

Further actions

Ok now i used lsusb and it said Western Digital Drive connected and its Drive No is SDE. But by using dmesg it said that sdb is also a removable disk. Any suggestions

'sd 0:0:1:0: Attached scsi removable disk sdb
  Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: WDC       Model: WD2500YD-01NVB1   Rev: 10.0
  Type:   Direct-Access                      ANSI SCSI revision: 05
share|improve this question
    
(offtopic) Please don't use screenshots if you don't have to. You could just copy/paste. –  gertvdijk Dec 19 '12 at 11:41
add comment

2 Answers

up vote 1 down vote accepted

@umair i am not sure why sdb is showing as removable , could you post the o/p of this script

for device in /sys/block/*
do
    if udevadm info --query=property --path=$device | grep -q ^ID_BUS=usb
    then
        echo $device
    fi
done
share|improve this answer
    
Well the hard disk is already mounted and dmesg gives some 4 page output I didnt find this command helpful. –  OmiPenguin Dec 19 '12 at 10:50
    
@Umair lsusb this command will list all information about USB buses and devices that are attached to them, just see whether it helps –  LINUX4U Dec 19 '12 at 10:55
    
Dear I used lsusb and added the detail in Question under Further actions. Kindly check it. –  OmiPenguin Dec 19 '12 at 11:07
    
sdb is marked as removable, probably because the controller supports SCSI/SATA hotplugging - also called "hot swap". –  gertvdijk Dec 19 '12 at 11:40
add comment

I like to use this one-liner.

find /dev/disk/by-path -name "*-usb-*" -not -name "*-part*" -exec readlink -f {} \;

It will 1) list all devices with USB in its path somewhere, 2) filters for partitions and finally 3) reads the link it points to. Example output:

/dev/sdc

Important notes:

  • It will not work for external disks connected using another bus, e.g. eSATA, firewire, etc.
  • It's not able to distinguish USB flash drives and regular spinning hard drives.
share|improve this answer
    
Means it will also list the devices like mouse, Keyboard??? –  OmiPenguin Dec 19 '12 at 13:09
    
@UmairMustafa No. See the find path: /dev/disk. –  gertvdijk Dec 19 '12 at 13:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.