In Windows, you can check the hard drive serial number using wmic which you can access via Command Prompt. What about Linux?
There are several tools to retrieve the hard drive info in Linux. From GUI-based ones to command line-based tools like hwinfo. However, not all tools display the serial number of the hard drive installed on your Linux system, including hwinfo which only displays the hard drive model and vendor. It doesn’t mean that you have to disassemble your computer only to check the serial number of the installed hard drive. There are several alternative commands to retrieve hard disk info that display the serial number.
How to check the hard drive serial number in Linux
There are at least three commands to check the hard drive serial number in Linux: tsmartctl, lshw, and hdparm. Before using these tools, you need to know the device names of your disks using the df command. The examples of the device names are names such as /dev/hda or /dev/sdb. Simply type
df on terminal to check the device names of your disks.
- Check the hard drive serial number using lshw.
lshw is a tool used to display the list of hardware installed on your computer. This tool has been installed by default on the vast majority of Linux distros. To use this tool to display the hard drive serial number, you can type the following command.
lshw -class disk
- Check the hard drive serial number using smartctl
smartctl is a tool part of the smartmontools package. It is not installed by default on the vast majority of Linux distros. If you use Ubuntu and the derivatives, you can type
sudo apt install smartmontools to install the package. Type the following command to use smartctl to see the hard drive serial numer.
smartctl -i /dev/sda
- Check the hard drive serial number using hdparm
Another tool to check the hard drive serial number in Linux is hdparm. This tool itself is designed to set and view ATA hard drive parameters and test performance. You can type the following command to use hdparm to see the hard drive serial number.
hdparm -i /dev/sda
Please note that all commands above require root access. In Debian-based distros (Ubuntu, Linux Mint, and so on), you can add the sudo prefix on each command.