Monday, October 3, 2022

How To Find Hard Disk Information on Linux

In this article, we want to teach you How To Find Hard Disk Information on Linux.

A computer hard drive (or a hard disk or HDD) is one kind of technology that stores the operating system, applications, and data files such as documents, pictures, and music that your computer uses.

The rest of the components in your computer work together to show you the applications and files stored on your hard drive.

Find Hard Disk Information on Linux

Linux comes with different commands to find information about your hard disk.

Let’s get familiar with the Linux commands to find the information about the hard disk.

The lsblk command on Linux

To list information about all available or specified block devices, you can use the following commands.

Block devices are characterized by random access to data organized in fixed-size blocks. Examples of such devices are hard drives, CD-ROM drives, RAM disks, etc.

# lsblk
# lsblk /dev/DISK
# lsblk /dev/sda

Also, you can use the following command to list all disks and their names:

ls -lF /dev/disk/by-id/

Linux shows block devices such as hard disk attributes. To do this, you can run the following command:

blkid

Find Information about a Drive on Linux

The “hdparm” command tool is used to provide the interface for kernel-supported devices. It is to display the drive disk statistics and set hardware parameters and testing performance.

First, you need to install it on your Linux server to find the drive disk statistics.

On Debian / Ubuntu, use the following command:

apt install hdparm

On Centos / RHEL, you can use the following command:

yum install hdparm

Then, use the following to display complete information in an expanded format about a drive:

hdparm -I /dev/sda

The lshw command on Linux

The “lshw” command is a small tool to display a complete picture of hardware configuration. While using this command in a terminal, you will get a print of CPU version, memory configuration, cache information, bus speed, and other PowerPC machines running on the backend.

First, you need to install it on your Linux server.

On Debian / Ubuntu, use the following command:

apt install lshw

On Centos / RHEL, you can use the following command:

yum install lshw

To display all disks and storage controllers in the system, you can use the following command:

lshw -class disk -class storage

Also, you can find Linux disks names with the following command:

lshw -short -C disk

Another way is to use the fdisk command:

fdisk -l

The smartctl command on Linux

The smartctl command is useful on physical Linux servers where smart disks can be checked for errors & bad sectors and extract info regarding the disks that are used behind the Hardware RAID.

To install it on your Linux servers you can use the following commands.

On Debian / Ubuntu:

apt-get install smartmontools

On Centos / RHEL:

yum install smartmontools

Start the smartctl service on your Linux servers with the commands below:

For Debian / Ubuntu:

/etc/init.d/smartmontools start

For Centos / RHEL:

service smartd start ; chkconfig smartd on

To get information about /dev/sda run the command below:

smartctl -d ata -a -i /dev/sda

Conclusion

At this point, you learn to find information about your hard disk on Linux with the different Linux commands.

Hope you enjoy it.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles