• العربية
  • Azerbaijani
  • Català
  • 中文
  • Hrvatski
  • Čeština
  • Dansk
  • Nederlands
  • English
  • Estonian
  • Persian
  • Français
  • Deutsch
  • עברית
  • Magyar
  • Italiano
  • Macedonian
  • Norwegian
  • Português
  • Português
  • Română
  • Русский
  • Español
  • Svenska
  • Türkçe
  • Українська
  • Account
    • Login
    • Register
    • Forgot Password?
  • FairyHosting.com
    • Services
      • My Services
      • Order New Services
      • Domains
      • DNS MANAGER
    • Payment
      • Invoices
      • Add funds
      • Mass Payment
    • Support
    • Knowledgebase
    • Affiliates

      Categories

    Hestia CP
    2
    ISPmanager
    9
    Linux Server
    25
    Plesk
    14
    Windows Server
    14
    Fairy Disk Services
    4
    Mikrotik (RouterOS)
    8
    Server management
    19
    For a new client
    13

      Categories

      Tag Cloud

    Debian Восстановление root пароля CentOS7 Linux сброс root пароля CentOS7 сервер Password recovery Root password Ubuntu

      Support

    My Support Tickets
    Knowledgebase
    Open Ticket

    Checking disks with the Smartmontools utility + sending the results to an email address Print

    • 92

     

    Installation and configuration of smartmontools for checking disks on a physical server.

     

    The smartmontools package consists of two utilities, smartctl and smartd, which monitor system drives using self-testing, analysis, and the S.M.A.R.T. system. This package is available on most modern Linux systems.

     

    smartctl - allows viewing SMART disk parameters and running tests manually via the console. It is used for one-time testing of hard drives.

     

    smartd - monitors the polled device (configurable by time), provides error logs, and tracks attribute changes. It is used for autonomous monitoring.

     

    Installation

     

    Installing a set of utilities for monitoring hard drives.

     

    Debian/Ubuntu:

     

    apt-get update

     

    apt-get install smartmontools

     

    CentOS:

     

    yum update

     

    yum install smartmontools

     

     

    Information about drive

     

    Now you can view information about the drives. Simply enter the command:

     

    smartctl -i /dev/sdx

     

    where "x" is the letter of the disk, it may not be sda, for example, it could be vda.

     

     

    For example with HDD:

     

    For example with SSD:

     

    You can view the disks in the system using the following commands:

     

    lsblkl
    
    s -la /dev/ | grep sd

    If S.M.A.R.T. support is: Disabled, then to enable it, you need to execute the command:

    P.S.: However, it is necessary to ensure that the disk supports S.M.A.R.T. Technology

    smartctl -s on /dev/sda

     

    Now we can display all the data using the smartctl command with the -a option and specify the disk that needs to be analyzed.

    smartctl -a /dev/sda

    First, the information about the model of your HDD and SSD will be provided. Then the model information will be displayed.

     

    Disk Testing

     

    There are two types of testing - short and long.

     

    The short test is initiated by the command:

     

    smartctl -t short /dev/sda

     

    The long test is initiated by the command:

     

    smartctl -t long /dev/sda

     

    The results of the tests can be viewed using the command:



    smartctl -l selftest /dev/sda

    P.S. If you need to cancel test, use the command: smartctl -X



    Setting up automatic disk health checks and notifications upon error occurrence



    Configuring the S.M.A.R.T. daemon:

    nano /etc/default/smartmontools



    In the file you need to uncomment two lines:

    start_smartd=yes
    
    smartd_opts="—interval=120"





    Please note that in this example, the value "120" means 120 seconds. This means that every 2 minutes an email will be sent with disk status monitoring. If, for example, you need to set up email sending every 2 hours, then the line will look as follows.

    smartd_opts="—interval=7200"



    Now you need to edit the configuration file and set the necessary parameters for sending test results to email.

    nano /etc/smartd.conf
    /dev/sda -a -o on -S on -s (L/../../4/16) -m root -M exec /usr/share/smartmontools/smartd-runner

    If you need to add another disk for monitoring, then write the same thing starting from the next line, only specify a disk other than sda, for example, sdb.

    /dev/sdb -a -o on -S on -s (L/../../4/16) -m root -M exec /usr/share/smartmontools/smartd-runner

    Each value in the line answer to a separate parameter:

    -a - Disk health analysis

    -o on - Enable S.M.A.R.T. tests to update attribute status

    -S on - Enable automatic attribute saving

    -s - Self-test, in this case (L - "long" run long test on Thursdays at 16:00). If you need to select multiple days for monitoring, specify the desired range, for example, from Monday to Sunday will be 1-7. The format specified in parentheses is as follows (Test type/month-year "01-12"/day "01-31"/day of the week "1-7"/time in hours "00-23")

    -m - Mail point of contact for issues. In this example, mail will be sent to the root user (you can set redirection to the required mailbox in /etc/aliases). Instead of the root parameter, you can also specify the required e-mail address (-m [email protected])

    -M - Parameter responsible for modifying the message before sending. In this example, the script /usr/share/smartmontools/smartd-runner is launched. This option is useful if you need to select a different mail client, for example.

     

    After setting all the necessary parameters, restart the smartmontools with the following command:

    service smartmontools restart




    Was this answer helpful?

    Related Articles

    Ioncube installation Ioncube install on Debian server.   1. Archive download from website creator wget... Upload/download internet speed check in Linux Speedtest-cli is used to check the speed of uploading and downloading in the server and it use... Update nginx on Debian 6 1. Download nginx key wget http//nginx.org/keys/nginx_signing.key 2. Add him apt key add... Ioncube PHP Loader installation Install Ioncube PHP Loader extensions via SSH client.Firstable download module for your operating... How to change SSH port Default SSH server port is 22. Open configuration file /etc/ssh/sshd_config of SSH server by...
    « Back

      Tag Cloud

    Debian Восстановление root пароля CentOS7 Linux сброс root пароля CentOS7 сервер Password recovery Root password Ubuntu

      Support

    My Support Tickets
    Knowledgebase
    Open Ticket
    • Billing
      • Services
      • Invoices
      • Support
      • Knowledgebase
    • Services
      • Virtual servers
      • Dedicated servers
      • Colocation
      • Business hosting
      • Fairy Disk
      • Routers for rent
      • SSL-Certificates
    • News
    • Company
      • About Us
      • Contacts
      • User agreement
      • Privacy policy
    • Technologies

      RJ Network OÜ
      Reg.nr 14694302
      VAT ID: EE102147829

      Narva: P. Kerese tn 5, 20309
      Tallinn: Paul Pinna 8, 13615

    Telegram Chat

    +372 6647001

    [email protected]

    Copyright © 2025 FairyHosting.com. All Rights Reserved.


    Loading...
    Loading...
    Choose language
    العربية
    Azerbaijani
    Català
    中文
    Hrvatski
    Čeština
    Dansk
    Nederlands
    English
    Estonian
    Persian
    Français
    Deutsch
    עברית
    Magyar
    Italiano
    Macedonian
    Norwegian
    Português
    Português
    Română
    Русский
    Español
    Svenska
    Türkçe
    Українська

    Generate Password

    Please enter a number between 8 and 64 for the password length