How to Check Harddrive information: Difference between revisions

From DISI
Jump to navigation Jump to search
(a small collection of commands for checking information regarding hard disk sizes, partitions, and capabilities)
 
(No difference)

Latest revision as of 20:56, 9 June 2017

Here are several commands that will allow us to check information regarding hard drives.

fdisk: for hdd sizes/partitions

fdisk is useful for checking the sizes and partitions of hard drives that are connected to a host. Physical hard disks are usually given a name of /dev/sd[a-z]. Using the command as root:

fdisk -l 

will provide us information regarding all the physical hard disks that are located on the host and all the partitions that reside on those disks. Non-physical disks are included in the output too.

You will see devices such as:

Disk /dev/sdc                                 // physical hard disk
Disk /dev/md[0-10]                            // software raid volume
Disk /dev/mapper/vg_system-lv_root            // logical volume

cat /proc/scsi/scsi for actual models of HDDs

We have a variety of different HDD models we use from various companies. We'll often encounter an HDD we find to be reliable or a model we want to avoid altogether for the rest of our lives. Since
we don't always have physical access to the interior of a machine to check the HDD models, the easiest way to check what model is in a host is to check under /proc/scsi/scsi.

[root@he bulk]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
 Vendor: ATA      Model: Samsung SSD 840  Rev: BB6Q
 Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
 Vendor: ATA      Model: Samsung SSD 840  Rev: BB6Q
 Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
 Vendor: ATA      Model: WDC WD1000CHTZ-0 Rev: 6A01
 Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi3 Channel: 00 Id: 00 Lun: 00
 Vendor: ATA      Model: WDC WD1000CHTZ-0 Rev: 6A01
 Type:   Direct-Access                    ANSI  SCSI revision: 05

cat /sys/block/sd*/queue/rotational check if HDD/SSD

If you're not sure whether the disks on your system are HDDs or SSDs, do the simple command:

cat /sys/block/sd*/queue/rotational

The output is in descending order starting from the first disk detected, usually sda.

This will output either 0 or 1.

0 == SSDs
1 == HDDs

Example:

# My first disk is an SSD
[root@he fast]# cat /sys/block/sda/queue/rotational 
0
# I have two SSDs, /dev/sda & /dev/sdb, and two HDDs /dev/sdc & /dev/sdd
[root@he fast]# cat /sys/block/sd*/queue/rotational 
0
0
1
1