Whether you suspect there’s an issue or you just want to stay ahead of possible problems, it’s a good idea to learn how to check SSD health in Linux. Anytime you notice any problems, such as slow loading speeds or missing data, check your SSD. If something’s wrong, you’ll have time to save your data before the drive fails.
Note: you can also check the SSD health for your Mac.
Get the Name of Your Drive
The first step, no matter what distro you’re using, is to get the name of your SSD. You’ll need this to run the SSD health check tools.
There are a variety of tools to run. For my example, I’m using lsblk
in the Terminal. However, you could also use cfdisk
, df
, hwinfo
, fdisk
, sfdisk
, or lshw
.
Remember the name of the SSD you want to check before proceeding. Usually, looking at the size helps you tell them apart easily.
If you don’t see a drive or you want to check an external drive, learn how to mount a drive in Linux.
Check SSD Health in Linux Using Disks
Disks is a GUI method for checking your SSD’s health in Ubuntu. Start by opening the Disks utility, which is usually installed by default. If it’s not installed, run the following command in Terminal to install it:
sudo apt install gnome-disk-utility
Select your disk and click the three dot menu at the top right. Then, select SMART Data & Self-Tests.
Click Start Self-Test at the bottom of the new window and view the results. Ideally, you want to see an Overall Assessment of Disk is OK just above the SMART Attributes list.
Use Smartctl (Smartmontools)
The command line tool smartctl
is included with smartmontools, which you’ll need to install. It’s available for Ubuntu, Debian, LinuxMint, Fedora, RHEL, and CentOS distros.
While I’m using Ubuntu in my examples, you can use the following command to install smartmontools for your distro:
Ubuntu, LinuxMint, and Debian
sudo apt install smartmontools
RHEL and CentOS
sudo yum install smartmontools
Fedora
sudo dnf install smartmontools
Once installed, run the following command, but replace “sda” with your drive:
sudo smartctl -t long -a /dev/sda
The smartctl portion gathers details on available drives, while the -t long
portion tells the tool to run a long test (1-2 hours). If you want a shorter test (approximately two minutes), use -t short
instead.
If you get an error that SMART isn’t enabled on the drive, run (replace sda with your drive):
sudo smartctl -s on /dev/sda
For short tests, you may not see a full list of attributes. Instead, you may just see a pass/fail result or a “completed without error” result. For longer tests, a few attributes to pay attention to in the results include:
- Temperature_Celsius – The min and max values should be either the same or close. Extreme fluctuations could mean something’s wrong with your drive, power supply, CPU, or other hardware.
- Reallocated_Sector_Ct – This tells you how many bad sectors have had to be remapped. The higher the number, the closer your SSD is to failing.
- Media_Wearout_Indicator – This indicates how close the drive is to failing based on its average lifecycle. The highest value is 100, which is ideal. If the number gets closer to zero, it’s time to replace it immediately.
- Reported_Uncorrect – This attribute tells you how many errors were encountered that couldn’t be fixed. A high number of errors is a bad sign.
Use nvme-cli to Test NVMe SSDs
The above method doesn’t work on all types of SSDs. In order to check SSD health in Linux for a NVMe drive, run the nvme-cli
tool. It works similarly to smartctl and shows various attributes related to your drive’s health.
Install the tool by running the following command in Terminal:
sudo apt install nvme-cli
The above is for Ubuntu and Debian-based distros. Replace apt
with dnf
for Fedora or yum
for CentOS and RHEL distros.
Once successfully installed, run the following to test the drive, replace sda with your drive name:
sudo watch -n 1 nvme smart-log /dev/sda
For this command, watch -n 1
tells the tool to check the SMART log each second. The nvme
portion refers to the type of drive, while the smart-log
portion tells the tool to check the SMART log.
After running the tool, check the following results to get a better idea of your SSD’s health in Linux:
- Temperature – A safe range is 30°C to 65°C (86°F and 149°F). Usually, it’ll stay within the 30°C to 40°C range unless you’re a power user.
- Percentage_Used – You want this number to be as low as possible. As it creeps over halfway, your SSD could be in trouble.
- Media_Errors – A few errors aren’t much to worry about. But, if you start seeing a larger number of errors, it means more of your drive is unreadable.
Check SSD Health in Linux With KDE Partition Manager
KDE Partition Manager is a GUI to help you manage your Linux partitions and drives. You can also use these tools to help create new Linux partitions. However, much like GNOME Disks, it lets you run a SMART check on drives. It works on Ubuntu, Debian, CentOS, Fedora, RHEL, OpenSUSE, ArchLinux, and Gentoo. Full commands for each distro are available on the source code page linked above.
I’m using Ubuntu, so I’d install KDE Partition Manager by running the following:
sudo apt install partitionmanager
After it’s installed, open KDE Partition Manager from your list of apps. Once open, go to Device -> SMART Status.
Ideally, you’ll get a Status of Good. Also, check the temperature and bad sectors. If the temperature is running too high or you have numerous bad sectors, consider replacing your SSD.
Use GSmartControl to Check SSD Health
If you like how smartctl works, but prefer a graphical interface, try GSmartControl. It works on most platforms, including most Linux distros. Install GSmartControl using the instructions provided for your distro.
Once installed, run GSmartControl. It lists all available drives, including those that may not support SMART monitoring. Click on the drive you want to view more details about. Then, select the Attributes tab. This gives you most of the same details as smartctl, but in an easier-to-read format.
One benefit of GSmartControl is if you hover over any attribute, a pop-up explains exactly what is being tested and how to determine if the values are good or bad. Continue digging more into your Linux SSD’s health by checking some of the other tabs too, such as Temperature Log.
Check out the Self Tests tab to run more tests, similar to smartctl. Run both short and longer tests to see the same data you’d see when using smartctl from Terminal.
If the Worst Happens
Now that you know how to check SSD health in Linux, it’s a good idea to prepare for the worst. If your drive is showing early signs of failure, make sure you have a backup ready. Use these backup tools for Linux to help. If you’re buying a new SSD, here’s what to look for. And, these are some of the best options to buy.
Image credit: Pexels, All screenshots by Crystal Crowder
Our latest tutorials delivered straight to your inbox