How to check ssd health linux

How to Test SSD/HDD Health in Linux?

To protect the data on the SSD/HDD disks, especially with the limited lifespan, the experts recommend keeping a check on its health. The SSD/HDD is not immune to damage and corruption, which leads to data loss. To prevent it, users can test SSD/HDD health after identification of drives using various methods on Linux.

This guide elaborates on the approaches to test SSD/HDD health in Linux effectively.

  • View List of Disks
  • Method 1: Using Smartctl
  • Method 2: Using nvme-cli
  • Method 3: Using Disks Application (GUI)

How to View the List of Disks on Linux?

Many tools are available to view the list of disks on Linux, such as lsblk, df, fdisk, hwinfo, and many more, discussed here in detail. Let’s use the lsblk command to view a list of disks:

The output shows disk partitions “sda1”, “sda2” and “sda3” in the operating system and a system can have multiple hard drives.

Note: The above output is from Ubuntu installed on the Vmware Workstation, and the output on your end can be different.

Method 1: Using Smartctl on Linux

The Smartctl comes in the “smartmontools” package. It has a self-monitoring feature to monitor the system’s performance. The Smartctl tool supports ATA/SATA, SCSI/SAD, and NVME. It is not pre-installed in the Linux distro. It can be installed using these commands:

$ sudo apt install smartmontools #Ubuntu/Debian/LinuxMint $ sudo dnf install smartmontools #Fedora $ sudo yum install smartmontools # RHEL/CentOS

The above figure confirms that the installation of smartmontools has been done on Ubuntu.

To test the SSD/HDD for health, understand this command before executing it:

  • smartctl is there to view the information on storage devices
  • -t long specifies that a long self-test is to be performed to check the entire surface of the drive for any potential issues
  • -a displays the current status and attributes of the disk
  • /dev/sda is the name of the drive to check
$ sudo smartctl -t long -a /dev/sda

The current drive on the system does not support Self Test logging but this

Method 2: Using nvme-cli to Test SSD/HDD Health

Another popular tool named “nvme-cli” can be used to check SSD/HDD health. This is designed especially for the NVME type SSDs, as expected from the name. To install it, use these commands:

$ sudo apt install nvme-cli #Ubuntu/Debian $ sudo dnf install nvme-cli #Fedora $ sudo yum install nvme-cli #RHEL/CentOS

The above image confirms the installation of nvme-cli has been done on Ubuntu.

Читайте также:  Etc security user linux

To test the SSD/HDD for health, use this command after understanding it:

  • The watch utility is used to continuously monitor the SMART log
  • -n 1 tells the watch command to monitor the SMART log every second
  • nvme is used to manage the NVMe devices
  • smart-log is used with the nvme command to view the SMART logs
  • /dev/nvme0n1p is the drive being monitored
$ sudo watch -n 1 nvme smart-log /dev/nvme0n1p6

In the above figure, users can check the percentage_used, which is 3% (good health). While if it is over 50%, you should be worried and consider changing the drive. Additionally, users can visualize the “power_on_hours”, “unsafe_shutdowns”, and many more in the terminal.

Note: The above command is executed in dual-boot, and the drive used is NVME.

To check the temperature of the NVME, use the grep command to filter it like this:

$ sudo nvme smart-log /dev/nvme0n1p6 | grep "^temperature"

As seen in the above image, make sure that the temperature remains between 0 and 70 degrees Celsius. If the temperature exceeds this limit, it could cause serious damage to the drive, which ultimately leads to data loss.

Method 3: Using Disks Application (GUI)

To check the SSD/HDD health via the graphical interface, use the GNOME Disk Application by following these steps:

Step 1: Open Disk Application

To open the disk application, click on “Activities” from the top right corner of the screen and then type “Disks” in the search bar and open it:

After clicking on “Disks,” a new window opens up.

Step 2: Select Disk and do SMART Data & Self-Tests

From the new screen, select the drive you want to test (1). Next, choose disk (2). Now click on three dots and then pick the “SMART Data & Self-Tests” option: The disk on the current system does not support this feature, so the option is greyed out. So use the CLI methods discussed above when this option is unavailable.

Conclusion

Linux offers the “Smartctl” and “nvme-cli” command line tools to test the health of SSD/HDD. These tools are used to visualize the “percentage_used ”, “power_on_hours”, “unsafe_shutdowns”, and many more in the terminal. Users can also utilize the “Disks” application in GUI to test SSD/HDD’s health.

Читайте также:  Astra linux postgresql перезапуск

This guide explained the methods to test SSD/HDD health on Linux.

TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY

Источник

How to Test SSD/HDD Health in Linux

SMART (Self-Monitoring, Analysis, and Reporting Technology) is a feature enabled in all modern hard disk drives and SSDs to monitor/test reliability. It checks different drive attributes to detect the possibility of drive failure. There are different tools available in Linux and Windows to perform the SMART tests.

In this tutorial, we will learn how to test SSD/HDD health in Linux from CLI and GUI

Two methods explained here are:

Test SSD Health using Smartctl

Smartctl is a command-line utility tool that can be used to check S.M.A.R.T-enabled HDD or SSD status in the Linux system.

Smartctl utility tool comes with the package smartmontools. The Smartmontools is available by default in all Linux distributions including Ubuntu, RHEL and Centos and Fedora.

To install smartmontools in Linux:

sudo apt install smartmontools 

Start the service using the following command.

sudo /etc/init.d/smartmontools start

RHEL and CentOS

sudo yum install smartmontools
sudo dnf install smartmontools

Smartd service will start automatically after the successful installation.

If not started, start smartd service:

sudo systemctl start smartd

Test health of SSD/HDD

To test overall-health of the drive, type:

sudo smartctl -d ata -H /dev/sda

d — Specifies the type of device.
ata — the device type is ATA, use scsi for SCSI device type.
H — Check the device to report its SMART health status.

Checking overall-health of the drive

The result PASSED indicates that the disk drive is good. If the device reports failing health status, this means either that the device has already failed or could fail very soon.

If it indicates failing use -a option to get more information.

Smartctl command - SMART attributes

You can monitor the following attributes:

[ID 5] Reallocated Sectors Count — Numbers of sectors reallocated due to read errors.

[ID 187] Reported Uncorrect — Number of uncorrectable errors while accessing read/write to sector.

[ID 230] Media Wearout Indicator — Current state of drive operation based upon the Life Curve.

100 is the BEST value and 0 is the WORST.

Check SMART Attribute Details for more information.

To initiate the extended test (long) using the following command:

sudo smartctl -t long /dev/sda

Initiating extended test

To perform a self test, run:

sudo smartctl -t short /dev/sda

Initiating self test using smartctl

To find drive’s self test result, use the following command.

sudo smartctl -l selftest /dev/sda

smartctl self test result

To evaluate estimate time to perform test, run the following command.

Читайте также:  Linux find files group

Calculating estimated time to perform test

You can print error logs of the disk by using the command:

sudo smartctl -l error /dev/sda

Printing error logs of the drive

Test SSD/HDD Health using Gnome Disks

With GNOME disks utility you can get a quick review of your SSD drives, format your drives, create a disk image, run standard tests against SSD drives, and restore a disk image.

Install Gnome Disks

In Ubuntu 20.04, the GNOME Disks application comes with the GNOME disk tool installed. If you are unable to find the tool, use the following command to install it.

sudo apt-get install gnome-disk-utility

GNOME Disk is now installed, now you can go to your desktop menu navigate to the application, and launch. From the application, you can overview all your attached drives. You can also use the following command to launch the GNOME Disk application.

Now the test can be performed on the drives. To do so, launch the GNOME disks and select the disk which you want to test. You can find the quick assessment of the drives such as size, partitioning, Serial number, temp, and health. Click on the gear icon and select SMART Data & Self-tests.

In the new window you can find the results of the last test. In the top right of the window, you can find that the SMART option is enabled. If SMART is disabled, it can be enabled by clicking on the slider. To start the new test click on the Start Self-test button.

Once the Start Self-test button is clicked, a drop down menu will be appeared to select the type of the tests which are Short, Extended and Conveyance. Select the test type and provide your sudo password to continue the test. From the progress meter, percentage of the test complete can be seen.

Conclusion

In this tutorial, I have explained the basic concept of the S.M.A.R.T technology including its uses in the Linux system. Also, I have covered how to install the smartctl command-line utility tool in the Linux machine and how it can be used to monitor the health of hard drives. You have also got an idea about the GNOME Disks utility tool to monitor SSD drives. I hope this article will help you to monitor your SSD drives using smartctl and GNOME Disks utility.

If this resource helped you, let us know your care by a Thanks Tweet. Tweet a thanks

Источник

Оцените статью
Adblock
detector