Table of Contents

Ubuntu - Disk - Get disk info

To check hardisk information such as model and serial number, there are a few useful commands like hdparm, sdparm and fdisk.

To check the information about first hardisk for PATA and SATA hardisk:

hdparm -i /dev/sda

returns:

/dev/sda:
 
 Model=CT2000MX500SSD1, FwRev=M3CR023, SerialNo=1914E1F90669
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=1, MultSect=off
 (maybe): CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=3907029168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: unknown:  ATA/ATAPI-4,5,6,7
 
 * signifies the current active mode

For SCSI disks

sdparm /dev/sda

To check the hardisk capacity and partitions contained in the hardisk

fdisk -lu /dev/sda

returns:

Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 2300B8B9-F7DD-4E5C-B2EF-84A5EC8D5D66
 
Device       Start        End    Sectors  Size Type
/dev/sda1     2048    1050623    1048576  512M EFI System
/dev/sda2  1050624 3907028991 3905978368  1.8T Linux LVM

For LVM disks

lvscan

returns:

  ACTIVE            '/dev/ubuntu-vg/root' [<1.82 TiB] inherit
  ACTIVE            '/dev/ubuntu-vg/swap_1' [976.00 MiB] inherit