Skip to content

Checking Disk and RAID Health

In this article

Signs of disk problems: I/O error messages in dmesg, the file system switching to read-only mode, the server "freezing" on writes, or a RAID array in the degraded state.

Note

Checking SMART and the RAID controller only makes sense on dedicated servers. On a VPS the disk is virtual and SMART data is not available — if you see I/O errors on a VPS, contact technical support.

If the system does not boot, you can run all the checks from Rescue mode.

Checking disks with SMART on Linux

  1. Install the smartmontools and nvme-cli packages:

    sudo apt install smartmontools nvme-cli    # Debian/Ubuntu
    sudo dnf install smartmontools nvme-cli    # AlmaLinux/Rocky/CentOS 8
    sudo yum install smartmontools nvme-cli    # CentOS 7
    
  2. List the disks:

    lsblk -o NAME,SIZE,TYPE,MODEL,SERIAL
    sudo smartctl --scan
    
  3. Run a quick health check and get the full report:

    sudo smartctl -H /dev/sda      # overall assessment: PASSED or FAILED
    sudo smartctl -a /dev/sda      # all attributes, error log, serial number
    

    For NVMe drives:

    sudo smartctl -a /dev/nvme0
    sudo nvme smart-log /dev/nvme0
    
  4. If needed, run a short self-test (about 2 minutes) and view the result:

    sudo smartctl -t short /dev/sda
    sudo smartctl -l selftest /dev/sda
    

Tip

If the disks are connected through a hardware RAID controller, smartctl /dev/sda shows the logical volume, not the physical disk. Specify the device type, for example smartctl -a -d megaraid,0 /dev/sda (the number is the disk ID on the controller), or use the controller utility.

Which attributes to check

A PASSED assessment does not guarantee that the disk is healthy. Check the RAW_VALUE of these attributes:

Attribute Meaning When to worry
5 Reallocated_Sector_Ct Bad sectors that have been reallocated Greater than 0 and growing
197 Current_Pending_Sector Unstable sectors waiting to be reallocated Greater than 0
198 Offline_Uncorrectable Uncorrectable sectors Greater than 0
199 UDMA_CRC_Error_Count Transfer errors over the cable or backplane Growing (usually a cable problem, not the disk)
187 Reported_Uncorrect Uncorrectable read errors Greater than 0
Media and Data Integrity Errors (NVMe) Media errors Greater than 0
Percentage Used (NVMe) Write endurance used Close to 100%
Critical Warning (NVMe) Critical controller warning Not equal to 0x00

Also check the kernel log:

sudo dmesg -T | grep -iE 'i/o error|ata[0-9]|nvme|medium error|reset'

Checking mdadm software RAID

Software RAID is built with mdadm if it was selected during OS installation.

cat /proc/mdstat

A healthy RAID1 array shows [2/2] [UU]. If there is a _ instead of a U (for example, [2/1] [U_]), the array is degraded — one of the disks has dropped out.

Detailed information about the array:

sudo mdadm --detail /dev/md0

Check the State field (clean is normal, degraded means the array is missing a disk) and the list of disks at the end of the output: a disk with the faulty or removed status should be checked with SMART.

Attention

A degraded array keeps working but no longer protects your data: if a second disk fails, the data will be lost. Make a backup immediately.

When the array is rebuilding, /proc/mdstat shows a recovery or resync line with the progress percentage. You can monitor the process with watch cat /proc/mdstat.

Checking hardware RAID

Find out which controller is installed:

lspci | grep -iE 'raid|sas'

The management utilities depend on the vendor. Download them from the controller or server manufacturer's website.

Broadcom / LSI MegaRAID — storcli (MegaCli on older systems):

sudo storcli64 /c0 show                 # overall controller and volume status
sudo storcli64 /c0/eall/sall show       # physical disk status
sudo MegaCli64 -LDInfo -Lall -aALL      # logical volumes (legacy utility)
sudo MegaCli64 -PDList -aALL | grep -iE 'slot|firmware state|media error|predictive'

Dell PERC — perccli (the syntax is the same as storcli):

sudo perccli64 /c0 show

A logical volume should be in the Optl (Optimal) state. The Dgrd (Degraded), Pdgd (Partially Degraded), and OfLn (Offline) states indicate a problem. For physical disks, Onln is normal, while Failed, Offline, UBad, and non-zero Media Error Count and Predictive Failure Count values indicate a problem.

Note

You can also view the state of the disks and the controller in the IPMI/iDRAC/iLO web interface (the event log and storage sections). Access to it is described in Hardware remote control.

Checking disks on Windows

In PowerShell:

Get-PhysicalDisk | Select-Object FriendlyName, SerialNumber, MediaType, HealthStatus, OperationalStatus
Get-PhysicalDisk | Get-StorageReliabilityCounter | Select-Object DeviceId, ReadErrorsUncorrected, WriteErrorsUncorrected, Temperature, Wear

On older Windows Server versions (2008/2012), you can use:

wmic diskdrive get model,serialnumber,status

Any value other than Healthy / OK indicates a problem. The free CrystalDiskInfo utility is handy for viewing SMART attributes. Disk errors are also shown in Event Viewer (the System log, sources disk, Ntfs, storahci, stornvme).

What to do if a disk is failing

  1. Back up your important data first to another server or storage, for example a storage server. Do not run fsck, write tests, or an array rebuild until your data is saved.
  2. Identify the failing disk: its model, serial number (smartctl -i /dev/sdX, storcli /c0/eall/sall show all), and its position in the array.
  3. Submit a Remote Hands request from the server card. Diagnostics and replacement of dedicated server components fall within the scope of Remote Hands. In the request, include:
    • the server ID;
    • the serial number and model of the failing disk;
    • the smartctl -a (or nvme smart-log) output for this disk;
    • the output of cat /proc/mdstat and mdadm --detail, or storcli /c0 show for hardware RAID;
    • confirmation that a backup has been made, and a convenient time for the work.
  4. After the disk is replaced, add it to the array. For mdadm, copy the partition table from the healthy disk and add the partitions to the array:

    sudo sfdisk -d /dev/sda | sudo sfdisk /dev/sdb     # for GPT: sgdisk -R /dev/sdb /dev/sda && sgdisk -G /dev/sdb
    sudo mdadm --manage /dev/md0 --add /dev/sdb1
    

    Replace the disk and array names with your own, and make sure you copy the partition table from the healthy disk to the new one. If the disk had a boot loader, install it on the new disk as well (grub-install /dev/sdb). A hardware controller usually starts the rebuild automatically.

Information

To learn about RAID levels and creating arrays during OS installation, see Creating a RAID Array.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×