How to monitor Disk Health on Linux/Windows?

Recently, we published an article about Disk Health Checks on our blog and explained what they are and the benefits they offer to system administrators. Today, we want to delve deeper into this topic and explore how disk health checks work on Windows and Linux servers.

What is a Disk Health Check?

A disk health check is the process of evaluating the condition and performance of a storage device, such as a hard disk drive (HDD) or solid-state drive (SSD). This includes checking for potential issues like bad sectors, wear and tear, read/write errors, and other signs of degradation that could lead to data loss or drive failure.

How to Check Disk Health on Linux

  1. Using smartctl from the smartmontools Package:
    • Installation:
      sudo apt-get install smartmontools # Debian/Ubuntu
      sudo yum install smartmontools # CentOS/RHEL
      sudo pacman -S smartmontools # Arch
    • Check Disk Health:
      sudo smartctl -a /dev/sda
    • Run a Self-Test:
      sudo smartctl -t short /dev/sda # Short test
      sudo smartctl -t long /dev/sda # Long test
    • View Test Results:
      sudo smartctl -l selftest /dev/sda
  2. Using badblocks:
    • Check for Bad Blocks:
      sudo badblocks -v /dev/sda
  3. Using fsck for Filesystem Check (only for unmounted partitions or during boot):
    • Check Filesystem:
      sudo fsck /dev/sda1
  4. Graphical Tools:
    • GNOME Disks (also known as gnome-disk-utility):
      sudo apt-get install gnome-disk-utility # Debian/Ubuntu

      Open GNOME Disks and select the drive to view SMART data and run tests.

How to Check and Monitor Disk Health on Windows

  1. Using Windows Built-in Tools:
    • CHKDSK (Check Disk):
      chkdsk C: /f /r
      • /f fixes errors on the disk.
      • /r locates bad sectors and recovers readable information.
    • Windows Disk Management: Access through Control Panel -> Administrative Tools -> Computer Management -> Disk Management.
    • Windows Explorer: Right-click on the drive -> Properties -> Tools tab -> Check.
  2. Using wmic (Windows Management Instrumentation Command-line):
    • Check SMART Status:
      wmic diskdrive get status

      Returns “OK” if the drive is healthy.

Monitoring Disk Health

Monitoring disk health on Linux and Windows is crucial for any business, even if you are running a system that doesn’t handle sensitive data. If a hard drive in your servers fails, your system goes down, data can be lost, and you will face significant challenges in restoring your data, even from backup files. Therefore, it is always better to monitor your hard drive health to get notified right away before a failure occurs.

There are several ways to monitor your disk health. Xitoring has recently developed an automated system that gathers information from your system, monitors your disk health, and notifies you immediately if something goes wrong.

To use an automated monitoring system for your hard drive health check, you need to register your server with Xitoring and activate the Health Check integration on your Linux/Windows server in just a few seconds.

For more information, please follow the documentation (Disk Health Integration) and get ready for your peace of mind.