67

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

81

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:

sudo smartctl --all /dev/sda
6
  • 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".
    – Allen
    Jul 29, 2015 at 18:22
  • 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.
    – Allen
    Jul 29, 2015 at 23:32
  • 1
    The command for "Disk Utility" is gnome-disks
    – kbuilds
    Nov 13, 2015 at 15:31
  • 1
    And it is packaged as ´gnome-disk-utility´.
    – Rovanion
    Jan 27, 2017 at 7:53
  • 1
    @Mehdi gnome-disks is the current incantation. It's not the same as palimpsest but it's close.
    – Oli
    Aug 21, 2019 at 13:43
23

You can also use gsmartcontrol, a GUI for smartctl.

8

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.

4
  • 6
    Why would shred be helpful here? Apr 4, 2013 at 0:45
  • 2
    @EliahKagan: I guess shred is suggested as a tool for stress testing the drive.
    – ntc2
    May 22, 2014 at 22:13
  • shred can be used as a digital data shredder to completly remove data from a drive, hence the name shred
    – s1mmel
    May 12, 2020 at 19:13
  • badblocks command does not make the drive lose data
    – Basil A
    Jun 23, 2020 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.