Keeping track of the Linux system’s hardware is one of the routine tasks carried out by system administrators. One of the vital hardware components in a Linux machine is the hard disk.
In Linux, block volumes or hard drives follow a naming convention given by device files. For example, /dev/sda
represents the first SCSI or SATA disk on the system, /dev/sdb
represents the second SCSI disk (sometimes a removable hard drive), and so on.
Having knowledge of the block volumes attached to your system is key and it allows for proper monitoring and resource tracking.
In this tutorial, we explore various ways that you can use to find out the type of hard disks available on your Linux machine.
1. lsblk Command – Find File System Type in Linux
The lsblk command is a utility that prints out information about the specified block volumes mounted on your system. It references the udev database and the sysfs filesystem to gather information about your hard drives.
It reads the LABELs, UUIDs, and filesystem types from block devices and prints them out to the terminal.
Without any command arguments, the lsblk command prints the following information. From the output, you can see that we have two volumes in the system; the sda
and sdb
volumes.
The sda
is the primary drive which has two partitions – sda1
which is the boot partition and sda2
which encompasses both the root and swap partitions. The sdb
volume is a removable drive with a single partition – sdb1
.
$ lsblk
To retrieve additional information about the mounted block volumes, pass the -f
option for ‘filesystems‘ as shown. This prints out more detailed information such as the filesystem type, label, and the UUID
$ lsblk -f
2. fdisk Command – Find File System Info in Linux
fdisk utility is a command line tool that is used for creating and manipulating disk partitions.
The -l
option, allows you to list detailed information about disk drives such as disk type and size, disk model, sector size, and other additional information.
$ sudo fdisk -l
3. hwinfo Command – Find Linux Disk Hardware Info
Another command you can use to check out the hard disk type is the hwinfo utility, which is a free and open-source utility for finding out the hardware information of a Linux system.
With the --disk
argument, the hwinfo command prints out all the hardware information pertaining to the block volumes or drives attached to the system.
$ hwinfo --disk
4. lshw Command – Find Linux Hard Disk Type
The lshw is a command-line tool that extracts fine details about the hardware configuration of a machine. It reports detailed information such as mainboard configuration, firmware version, memory configuration, CPU version and speed and so much more.
Combining lshw with -class
disk options prints out detailed information about your hard drives, which includes the description, product, vendor, bus info, version, size and so much more.
$ sudo lshw -class disk
5. Disk Utility – Check Linux Disk Info from GUI
Lastly, you can view hard disk information using the ‘Disks‘ application that is available for Linux distributions running the GNOME desktop environment.
This provides the following GUI dashboard with a list of all mounted disk volumes and CDROM.
Conclusion
In this guide, we have covered various ways of finding the type of hard disk mounted on your Linux system. Did we miss something? Let us know in the comment section.