In order to ensure good health of the computer system, disk monitoring plays an important role. This practice enables the observation of disk usage patterns, thus facilitating the identification and prevention of potential failures. Within the Linux ecosystem, built-in and third-party options, can be used for efficient and effective disk monitoring. In this post, we will explore the smartmontools utility, and how it can ensure the continued good health of your disk.

Introduction: Why You Should Monitor Health of Disk Drives

Monitoring the health of disk drives can help detect and mitigate potential failures. In the following sections, will discuss how to check the health of the disk in MacOs, Windows, and Linux. Next, we will take a deeper look at the output of the terminal based command for disk health in Linux (smartctl). Finally, we will discuss what each of these terms mean.

Monitoring disks in Linux

Linux has a tool called smartmontools, gsmartcontrolsin addition to a tool called .

– Install it using the package manager. For Debian or Ubuntu, the command would be

 $sudo apt install smartmontools

After the installation is complete, the following command is to be run:

$sudo smartctl -t long /dev/sdx

(replace /dev/sdx with the name of your drive).


What does the smartctl command in Linux actually tell us?

In order to understand what output we get from the smartctl command, let us look at the below example.

Checking Health of Disk Drives in Linux using smartctl

Command used on Kingston 240 GB M2. Sata SSD, and the drive is identified as /dev/sdb. The test was run on a Lenovo ThinkCenter M 900 Tiny, small form factor desktop.The boot drive (/dev/sda) is a 500 GB Crucial NVme drive.

The command we run is:
$ sudo smartctl -a /dev/sdb

The first information we get is:

$ smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.11.0-40-generic] (local build)Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===

Device Model: KINGSTON SA400M8 240G
Serial Number: xxxxx
LU WWN Device Id: xxxxx
Firmware Version: SBFK62B3
User Capacity: 240,057,409,536 bytes [240 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-3 T13/2161-D revision 4
SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Sun Nov 28 16:12:47 2021 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

You can find the full output by clicking here.

What do each of these entries mean

An explanation of each section from the smartctl output  is as below:

  • Device Model: This is the model name of your hard drive or SSD.
  • Serial Number: This is the manufacturer’s serial number for the drive.
  • LU WWN Device Id: This is the World Wide Name, a unique identifier used in storage technologies.
  • Firmware Version: This is the version of the firmware currently installed on your drive.
  • User Capacity: This is the storage capacity of the drive that’s available for use.
  • Sector Size: The drive’s sector size in bytes, both logical (used by the file system) and physical (used by the hardware).
  • Rotation Rate: This specifies the rotation speed of the drive. “Solid State Device” indicates it’s an SSD, which doesn’t have any moving parts, so there’s no rotation.
  • Device is: It tells you whether the drive is in the smartctl database. The database contains drive attributes to look for potential failures.
  • ATA Version is: The version of the ATA or ATAPI standard your drive supports.
  • SATA Version is: The SATA version the drive supports, including the maximum data transfer rate.
  • Local Time is: The current system time when the command was executed.
  • SMART support is: This indicates whether the drive supports SMART (Self-Monitoring, Analysis, and Reporting Technology). It should be available and enabled for smartctl to function correctly. This technology allows for the monitoring of the drive’s reliability to predict failures.

For Windows and Mac Users

Monitoring the health of disk drives can help detect and mitigate potential failures. Here’s how to do it in Windows and Mac using their in built tools.

1. Windows

The built-in tool to check disk health is called CHKDSK. To run it,

– Open Command Prompt as an administrator.
– Type `chkdsk C:` and hit enter (replace C with the letter of your drive).

Another way is to use Windows’ built-in “Drive Optimizer” (previously “Defragment and Optimize Drives”) tool.

2. MacOS

The built-in tool is called Disk Utility for monitoring health of disk drives. Newer Macs have a single disk in laptops and most mac Minis, so using the term “disk drive” might be more appropriate.

– Go to Applications -> Utilities -> Disk Utility.
– Select the drive from the sidebar, and click on ‘First Aid’ at the top.

Other Tools and Methods

Apart from these, there are also third-party software solutions to monitor health of disk drives. Some of these are CrystalDiskInfo (Windows), DriveDx (Mac),  that can provide more in-depth information about your hard drive’s health. Remember, while these tools can detect problems with your hard drives, always keep a backup of important data as all drives eventually fail.

AI generated image showing hard disks. Blog of Amar Vyas

Solid State Drives (SSds) are more robust than the older hard disk drives.

Summing it up

Disk monitoring in Linux is a critical task that should be part of every system administrator’s regular routine. Even for the everyday user, a periodic check (say, once every six month) to monitor the health of disk drives can help prevent untimely disk failures. With the help of some of the tools discussed, you can gain an understanding of what are the different tools for the three major operating systems for desktops or laptops, your disk usage, track performance, and even predict potential disk failures.

While these tools provide a robust solution for monitoring disk health, it is also important to remember that regular data backup is the most reliable way to prevent data loss. Ultimately, effective disk monitoring can lead to improved system performance, efficient resource management, and extended disk life.
A Desktop Computer Chassis. AI generated image used in Blog of Amar Vyas


This post is a part of a series of blog posts on the topic of computer upgrades. You can read the rest of the posts in this series here.

Categories: Notes Blog