top of page
Search

Self Monitoring Analysis And Reporting Technology Smartmontools For Linux

Years back my 500 GB hard drive was failing and the input/output readings where clear from using the smartmontools via the command line.


So after opening the front case of the desktop I discovered that the SATA cable was being pinched. Replacing the SATA cable worked however; a year later I had the same input/ouput errors and the hard drive finally died.


The good news was that the desktop 'ZT Systems' was still under warranty so I called the company and explained that the hard drive went south. As soon as ZT Systems received the old hard drive they sent me a brand new 1 TB drive. That same drive still runs great today in my new custom build.


I currently don't have smartmontools installed. However, on this Debian 11 system Synaptic has it.




To start the smartmontools on a Ubuntu or Debian based Linux system you would run the following command:

sudo /etc/init.d/smartmontools start


To check if the smart capability is enabled run:

smartctl -i /dev/sda

Should you have more than one hard drive on your Linux box you would change the /dev/sda to /dev/sdb and so forth.


To enable SMART capability for the hard drive run:

smartctl -s on /dev/sda

To disable SMART capability run:

smartctl -s off /dev/sda


If you need detailed information for your disk run these commands below.

smartctl -a /dev/sda This command is for a IDE drive


smartctl -a -d ata /dev/sda This command is for a SATA drive


For overall health of your hard drive run:

smartctl -H /dev/sda


There is a way to run a long test and a short test on your hard drive or drives.

The command for the long test is:

smartctl ---test=long /dev/sda

(If you want to abort the test run smartctl -X)


You can also redirect the output of the test to a log file.

To do that run:

smartctl ---test=long /dev/sda > /var/log/long.text


For the short test run:

smartctl ---test=short /dev/sda

To send the short test to a text file run:

smartctl ---test=short /dev/sda > /var/log/short.text


The short test is approximately 2 minutes long.

With the long test there isn't a time restriction because it will read & verify every segment of the entire disk.


To view a drives self test and the result you can run:

smartctl -l selftest /dev/sda (That's a small letter L after the hyphen)


There's a command to calculate and estimate the time to perform the test.

smartctl -c /dev/sda


To list the error logs on the disk drive run:

smartctl -l error /dev/sda (That's a small letter L after the hyphen)


For additional information you can go to www.smartmontools.org


Enjoy your Linux and the weekend too!


61 views0 comments

Recent Posts

See All
Post: Blog2_Post
bottom of page