Networking HowTos
Networking HowTos

List all hard disks connected to a CentOS system

February 1, 2013 CentOS, Linux

You often need to know what physical drives are attached to a system, how many drives are connected, or even what device names match up with which physical drive. There is a handy tool called ‘lshw’ which is used to extract detailed information on the hardware in the PC. Unfortunately this doesn’t come pre-installed on CentOS. The details below will go through installing lshw, and how to run it to list all the hard drives.
Prerequisites
This guide requires the EPEL repository to be configured.
Install the EPEL repostitory:

# yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

Install the lshw package:

# yum -y install lshw

List all disks in the system:

# lshw -class disk -short

This will list all disks and storage devices. This includes DVD drives, USB memory sticks, etc.
Example output:

# lshw -class disk -short
H/W path           Device      Class      Description
=====================================================
/0/100/7.1/0.0.0   /dev/cdrom  disk       DVD-RAM writer
/0/100/10/0.0.0    /dev/sda    disk       10GB SCSI Disk
#

You Might Also Like