- How can I check the health of my hard drive?
- 3 Answers 3
- Check your hard disk for problems
- Check your disk’s health using the Disks application
- What if the disk isn’t healthy?
- More Information
- How to check disk health status in Linux
- Steps to check hard drive health status in Linux:
- Check Disk Health in Linux/Ubuntu [How To / Guide]
- What is SMART?
- Using smartmontools/smartctl
- Checking Using badblocks
- Viewing SMART Status in a GUI Using gsmartcontrol
- Conclusion
How can I check the health of my hard drive?
I had a bad experience on an old Dell computer where shortly after installing Ubuntu on it, the hard drive failed due to excessive loading/unloading cycles. What is the best way to check the health of my hard drive in Ubuntu? Can it be done from the command line?
3 Answers 3
For the desktop, you can use «Disk Utility» (aka palimpsest or gnome-disks depending on the Ubuntu release) for this.
For the command line I suggest you install the smartmontools package and play around with smartctl . Eg:
What is the actual program name for «Disk Utility»? I don’t see an exact match for that. There are several «disk-related» programs when I search the dash for «disk utility» and I don’t like to guess. The most likely one I see is «Disks».
Looking here I see the screenshot looks like the UI for the application currently named «Disks». In the title bar shown in the screen shot, I see that it was called «Disk Utility», so I assume the name was changed at some point.
You can also use gsmartcontrol , a GUI for smartctl .
There is also a utility called badblocks, and another called shred. Both of these utilities can perform read/write operations on your write drive that can be used to make sure that a drive is safe for use. Personally, if I saw an error in either of these I’d replace the drive.
They are very slow and can take some time to complete, but can give you a an idea of their health. Also, since they are writing you’ll lose the data on the drive and should be run from live cd as suggested by caesay. I’ve been lugging around SystemRescueCd lately.
shred can be used as a digital data shredder to completly remove data from a drive, hence the name shred
Check your hard disk for problems
Hard disks have a built-in health-check tool called SMART (Self-Monitoring, Analysis, and Reporting Technology), which continually checks the disk for potential problems. SMART also warns you if the disk is about to fail, helping you avoid loss of important data.
Although SMART runs automatically, you can also check your disk’s health by running the Disks application:
Check your disk’s health using the Disks application
- Open Disks from the Activities overview.
- Select the disk you want to check from the list of storage devices on the left. Information and status of the disk will be shown.
- Click the menu button and select SMART Data & Self-Tests… . The Overall Assessment should say “Disk is OK”.
- See more information under SMART Attributes , or click the Start Self-test button to run a self-test.
What if the disk isn’t healthy?
Even if the Overall Assessment indicates that the disk isn’t healthy, there may be no cause for alarm. However, it’s better to be prepared with a backup to prevent data loss.
If the status says “Pre-fail”, the disk is still reasonably healthy but signs of wear have been detected which mean it might fail in the near future. If your hard disk (or computer) is a few years old, you are likely to see this message on at least some of the health checks. You should backup your important files regularly and check the disk status periodically to see if it gets worse.
If it gets worse, you may wish to take the computer/hard disk to a professional for further diagnosis or repair.
More Information
You can choose the displayed language by adding a language suffix to the web address so it ends with e.g. .html.en or .html.de.
If the web address has no language suffix, the preferred language specified in your web browser’s settings is used. For your convenience:
[ Change to English Language | Change to Browser’s Preferred Language ]
The material in this document is available under a free license, see Legal for details.
For information on contributing see the Ubuntu Documentation Team wiki page. To report errors in this documentation, file a bug.
How to check disk health status in Linux
S.M.A.R.T., or Self-Monitoring, Analysis, and Reporting Technology, is a system designed to monitor hard drive health. It is integrated into both traditional magnetic and SSD drives and can help predict drive failure, allowing you to take action before a problem occurs.
The smartctl tool, part of the smartmontools package, allows you to check the status of your S.M.A.R.T.-enabled hard disk drive (HDD) in Linux. This package is available in most Linux distributions, including Ubuntu.
To assess disk health in Ubuntu and other Linux distributions, install the smartmontools package and use the smartctl utility from the terminal. Note that S.M.A.R.T. does not cover disk errors like bad sectors or corrupted filesystems, so you may need additional methods for these issues.
Steps to check hard drive health status in Linux:
$ sudo apt update && sudo apt install --assume-yes smartmontools #Ubuntu and Debian
$ lsblk | grep disk sda 8:0 0 20G 0 disk sdb 8:16 0 5G 0 disk
$ sudo smartctl -t short /dev/sda smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-47-generic] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Execute SMART Short self-test routine immediately in off-line mode". Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful. Testing has begun. Please wait 2 minutes for test to complete. Test will complete after Wed Jul 17 15:58:30 2019 Use smartctl -X to abort test.
$ sudo smartctl -H /dev/sda smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-47-generic] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === SMART Health Status: OK
Author: Mohd Shakir Zakaria
Mohd Shakir Zakaria, a proficient cloud architect, is deeply rooted in development, entrepreneurship, and open-source advocacy. As the founder of Simplified Guide, he combines these passions to help others navigate the intricate world of computing. His expertise simplifies complex tech concepts, making them accessible to everyone. Discuss the article:
Comment anonymously. Login not required.
Check Disk Health in Linux/Ubuntu [How To / Guide]
Concerned that you have a failing hard drive? Make a backup. Then, use these Linux tools to check your disk/drive.
Not concerned that you have a failing drive? Back up anyway. It could be failing, and you don’t know it. Or it could get stolen. Or a meteorite could hit it.
Back. Up. Your. Files.
What is SMART?
S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) is the system most hard disks use to report their health to the installed system.
This information can be queried to find out whether a drive is reporting any issues.
Using smartmontools/smartctl
The smartmontools contains the smartctl package, which can query the SMART status of a physical hard drive.
You can install it on Ubuntu and Debian based systems by running:
sudo apt install smartmontools
Once installed, you provide it with the path to the device name for your hard disk, and it queries the SMART status of the drive and outputs the results:
Above, the -a option is passed, telling smartctl to print all available SMART information for that disk.
/dev/sda is the path to the hard disk you want to check the health of. If you don’t know what this is, you can find a list of disks that can be queried by running:
Most commands in this article are run using sudo as they require root/administrative privileges.
Checking Using badblocks
The badblocks tools come pre-installed on many distributions, including Ubuntu. It will check for bad blocks on your disk.
A block (or sector) is an area of the physical storage device where data is stored. badblocks will scan your disk block by block; if a block is damaged, it is marked as bad -, and the system actively avoids storing data on that part of the hard disk. When it’s done, you’ll get a full report on how many bad blocks were found.
Above, the -v option is used, which tells badblocks to be verbose and output as much information as possible while it is running. Finally,/dev/sda is the path to the device to be checked.
Running badblocks may take quite a while, depending on the size of the disk. However, once completed, you will receive a report on how many bad blocks or sector was found – which can be a good indicator of whether your disk has been damaged.
You can view the full user manual for backblocks by running:
Viewing SMART Status in a GUI Using gsmartcontrol
If you want to view the information provided by smartctl, but want to view it in a graphical window, you can use gsmartcontrol. Install it by running:
sudo apt install gsmartcontrol
You will be presented with a window containing a list of devices you can select:
…each can be clicked on to reveal SMART data, which can be inspected and exported.
Conclusion
Don’t bet on any of these tools. Drives fail ungracefully. Mechanical drives can jam up after being bumped at just the right angle. Power surges can happen. Cars can fly off of roads, bounce off of trees and crash through your house and destroy your computers. Please make a backup, and keep it somewhere safe.