Determining the model and serial number of a HDD in a Linux system

lsblk

If you need to know the model number and/or serial number of a hard disk drive (HDD) in a Linux system, one tool that you can use to obtain that information as well as other information on the drive is the lsblk utility, which is included in the util-linux package. E.g.:

# lsblk -o MODEL,SERIAL,SIZE,STATE --nodeps
MODEL            SERIAL            SIZE STATE
WDC WD10EZEX-00W WD-WCC6Y4ZYE4Y3 931.5G running
DVD A  DH16ACSHR 238229911623     1024M running
vmDisk-CD        13043003455      1024M running

You can see the list of arguments you can provide to the program with lsblk -h.

$ lsblk -h

Usage:
 lsblk [options] [<device> ...]

Options:
 -a, --all            print all devices
 -b, --bytes          print SIZE in bytes rather than in human readable format
 -d, --nodeps         don't print slaves or holders
 -D, --discard        print discard capabilities
 -e, --exclude <list> exclude devices by major number (default: RAM disks)
 -I, --include <list> show only devices with specified major numbers
 -f, --fs             output info about filesystems
 -h, --help           usage information (this)
 -i, --ascii          use ascii characters only
 -m, --perms          output info about permissions
 -l, --list           use list format output
 -n, --noheadings     don't print headings
 -o, --output <list>  output columns
 -p, --paths          print complate device path
 -P, --pairs          use key="value" output format
 -r, --raw            use raw output format
 -s, --inverse        inverse dependencies
 -t, --topology       output info about topology
 -S, --scsi           output info about SCSI devices

 -h, --help     display this help and exit
 -V, --version  output version information and exit

Available columns (for --output):
        NAME  device name
       KNAME  internal kernel device name
     MAJ:MIN  major:minor device number
      FSTYPE  filesystem type
  MOUNTPOINT  where the device is mounted
       LABEL  filesystem LABEL
        UUID  filesystem UUID
   PARTLABEL  partition LABEL
    PARTUUID  partition UUID
          RA  read-ahead of the device
          RO  read-only device
          RM  removable device
       MODEL  device identifier
      SERIAL  disk serial number
        SIZE  size of the device
       STATE  state of the device
       OWNER  user name
       GROUP  group name
        MODE  device node permissions
   ALIGNMENT  alignment offset
      MIN-IO  minimum I/O size
      OPT-IO  optimal I/O size
     PHY-SEC  physical sector size
     LOG-SEC  logical sector size
        ROTA  rotational device
       SCHED  I/O scheduler name
     RQ-SIZE  request queue size
        TYPE  device type
    DISC-ALN  discard alignment offset
   DISC-GRAN  discard granularity
    DISC-MAX  discard max bytes
   DISC-ZERO  discard zeroes data
       WSAME  write same max bytes
         WWN  unique storage identifier
        RAND  adds randomness
      PKNAME  internal parent kernel device name
        HCTL  Host:Channel:Target:Lun for SCSI
        TRAN  device transport type
         REV  device revision
      VENDOR  device vendor

For more details see lsblk(8).
$

lshw

You can also obtain hard disk drive and optical drive information using lshw, if you have the lshw package installed. If it isn't installed, you can install it on a CentOS Linux system using yum with yum install lshw.

# lshw -class disk
  *-disk                    
       description: ATA Disk
       product: WDC WD10EZEX-00W
       vendor: Western Digital
       physical id: 0
       bus info: scsi@2:0.0.0
       logical name: /dev/sda
       version: 1A01
       serial: WD-WCC6Y4ZYE4Y3
       size: 931GiB (1TB)
       capabilities: gpt-1.00 partitioned partitioned:gpt
       configuration: ansiversion=5 guid=e6a3618b-10b6-41b7-bb6b-84eecee2996a logicalsectorsize=512 sectorsize=4096
  *-cdrom:0
       description: DVD-RAM writer
       product: DVD A  DH16ACSHR
       vendor: hp
       physical id: 1
       bus info: scsi@3:0.0.0
       logical name: /dev/cdrom
       logical name: /dev/sr0
       version: JHG6
       capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
       configuration: ansiversion=5 status=nodisc
  *-cdrom:1
       description: SCSI CD-ROM
       physical id: 0.0.0
       bus info: scsi@0:0.0.0
       logical name: /dev/sr1
       capabilities: audio
       configuration: status=nodisc
#

You can obtain information on its usage with lsh -h.

Linux Command Line Tutorial For Beginners
Linux Command Line Tutorial
For Beginners
1x1 px



Save on a Computer: Run Windows, Mac, and Linux with VirtualBox
Save on a Computer: Run Windows,
Mac, and Linux with VirtualBox
1x1 px

# lshw -h
Hardware Lister (lshw) - B.02.17
usage: lshw [-format] [-options ...]
       lshw -version

	-version        print program version (B.02.17)

format can be
	-html           output hardware tree as HTML
	-xml            output hardware tree as XML
	-short          output hardware paths
	-businfo        output bus information

options can be
	-dump OUTFILE   save hardware tree to a file
	-class CLASS    only show a certain class of hardware
	-C CLASS        same as '-class CLASS'
	-c CLASS        same as '-class CLASS'
	-disable TEST   disable a test (like pci, isapnp, cpuid, etc. )
	-enable TEST    enable a test (like pci, isapnp, cpuid, etc. )
	-quiet          don't display status
	-sanitize       sanitize output (remove sensitive information like serial numbers, etc.)
	-numeric        output numeric IDs (for PCI, USB, etc.)

#