Fork me on GitHub

How to Check and Monitor Hard Disk Health on Linux with Smartmontools

источник: https://www.maketecheasier.com/monitor-hard-disk-health-linux/

Smartctl

  • To get information about a drive, use the -i option.
sudo smartctl -i /dev/sda 
  • if SMART support is available but not enabled, it can be turned on with the following command:

         ```bash
    

    sudo smartctl -s on /dev/sda ```

  • To check the device’s health, use the -H option:

    bash sudo smartctl -H /dev/sda

  • To view the SMART capabilities of the drive, use the -c switch:

    bash sudo smartctl -c /dev/sda

  • To run the short test, use the -t short switch, and correspondingly, the -t long option for the extended (and more thorough) test.

    bash sudo smartctl -t short /dev/sda

  • The test runs in the background, enabling you to perform other tasks while it runs. To check the results of the test, run the following command:

sudo smartctl -l selftest /dev/sda 
  • To fore checking of all sectors use badblocks in a mode in which data is written. Beware that even in general it's safe to call it will put extra load on your disks which might cause them to fail. Always have a backup of your data.
sudo badblocks -svvn -c 262144 /dev/sda

social