QUESTION :
There is a dock station in which I have put a hard drive. The dock station is connected through USB, but there is no command in linux which gives me serial number of harddrive connected through USB ? Tried
udevinfo -n <hard disk partion>
hdparm -i <hard disk partition>
udevinfo give some random number which is like 20 bit long but not serial number and hdparm does not give anything.
ANSWER :
Use lshw. Example :
~ # lshw -c disk
*-disk
description: ATA Disk
product: INTEL SSDSC2MH12
physical id: 0.0.0
bus info: scsi@4:0.0.0
logical name: /dev/sda
version: PPG2
serial: LNDL107600KE110CRN
size: 111GiB (120GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 sectorsize=512 signature=e565a8a5
~ #
The GNOME Disk Utility (palimpsest
) shows a “Serial Number” for my external USB hard drive. An equivalent shell command to get this serial number would be this (for /dev/sdf
):
qdbus --system org.freedesktop.UDisks /org/freedesktop/UDisks/devices/sdf org.freedesktop.UDisks.Device.DriveSerial
As you have written “<hard disk partition>
” in your question, you might also be interested in this command:
$ ls -l /dev/disk/by-uuid/ | grep sdf
lrwxrwxrwx 1 root root 10 Jun 3 23:28 2CA8109FA810699A -> ../../sdf1