Checking data consistency – 2 – smartmontools

In order to ensure the consistency of a data storage, a regularly check is recommended. This might be checking a hdd, sdd, usb stick, flash card (sd,cf). In general there is only a basic check by the operating system. This check is insufficient to guarantee no data loss. When using Linux there are some small tools that provide an enhanced check for data consistency. This second part describes the usage of smartmontools.

Smartmontools is a toolset that checks the status of an S.M.A.R.T capable device. A S.M.A.R.T device provides self monitoring, analysis and reporting (technology). In theory a device is able to report that it is not ok before there is a failure. But in practice this really doesn’t work. A study by google shows that there are many reasons and that S.M.A.R.T. may help. But it’s not a game changer.

The most interesting tool is smartctl. It’s so interesing as it directly provides to read the monitoring data of a device, as well as it is capable to check a device with different modes defined by S.M.A.R.T.

Why to use smartctl

It is possible to check all the monitoring data provided by a device. Furthermore it is possible to manually run a check of a device. In case there a error found by such a check this is a sufficiant reason to be worried about the healthiness of that device.

Getting the monitoring data

It provides things like the device model, serial number, firmware version, capacity, etc … but also some monitoring attributes.They are not a guarantee that a device is ok, but they might be an indicator, that a device is not ok.

Checking a device

In order to check a device there is a number of variants. But three of them are the most important:

short

A short test runs a few minutes and only checks the most important features. When a devices is not running any more such a short test is capable of proving that the device is really not ok. But for preventing a data loss that definatly is much too late.

long

A much more intensive test.This test runs all the tests possible and furthermore checks the whole surface of a hard disc whether it is possible to access every sector of the disk space.

offline

In this case the device is not available to the system during the whole test. Using this option on the boot device is not possible. This test runs in foreground.

In case there is a negative result, smartctl will show you. One of the most imporant features is the data consistency check. In case some sectors of the device are not readable it prints that sectors. But in order to get to know what excactly failed. -> rtfm. There are so many possible things that might not be ok. Asking the manual or your favorite search engine is a good idea. It’s just about getting to know that there is something not ok.

How/Why/When to run

It’s a good idea to periodically run a S.M.A.R.T. test. In case a hdd dies, they don’t do it suddenly. In case there is an error, it’s a good idea to safe all the data on the device. In case further tests on the device fail buy a new one. Nothing is more destructive than a failing device that contains important data. Even the data is not so important it’s quite annoying. So having a deamon that checks the device periodically prevents a lot of trouble.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.