For how long have I been using my computer?

Do you want to check how many hours you have been using your computer/laptop?

Do you want to find out if that second-hand hard disk salesman is saying the truth?

Are you about to buy a second-hand laptop that had been used only sparingly?

You can figure out what’s going on, with the help of your Linux box and the smartmontools package. Especially since I decided to keep my old hard disk that sits next to me.
Modern hard disks support a feature called Self-Monitoring, Analysis, and Reporting Technology (S.M.A.R.T.), which helps make them more reliable.

One of the data recorded by S.M.A.R.T. is the total number of hours a hard disk has been in operation. This is the S.M.A.R.T. attribute 09 called Power-On Hours (POH). When your computer is on, your hard disk is on as well, therefore you can get the total number
of hours your computer has been on. Let’s see how we put all of these in action.

You need to install the smartmontools package, available from the standard Ubuntu repositories.

  1. Start System/Administration/Synaptic Package Manager and search for smartmontools. Select the package for installation and click to Apply.
  2. Assuming your hard disk corresponds to device /dev/hda, run the command sudo smartctl –all /dev/hda on a terminal window.

You will get a long list of information and attributes. Wade through the output and notice the attribute list and the line with ID 09.
On my system it is

ID# ATTRIBUTE_NAME   …   UPDATED  WHEN_FAILED RAW_VALUE
9   Power_On_Hours     …   Always                 –                      24

Here you can see that this hard disk has been in operation for 24 hours in total. Yes, it’s a new hard disk.
If your hard disk is a bit exotic, you may see a strangely large raw value. Other manufacturers measure the time in minutes or seconds, so you need to convert accordingly.
Other information you may extra from S.M.A.R.T. include the temperature of the hard disk. The temperature has ID 194. For me it is

ID# ATTRIBUTE_NAME        …   UPDATED  WHEN_FAILED RAW_VALUE
194 Temperature_Celsius  …    Always                 –                     41

That is 41 degrees Celsius.

You can also perform self-tests on your hard disk in order to check if it is about to fail. In S.M.A.R.T. terminology there are short (1min duration) and long (30min duration) tests, and the last five results are saved in the hard disk non-volatile memory. The entry includes the number of hours the hard disk has been in operation as explained above. Therefore, when you loan a laptop to a hard working person that has to finish an essay, you can perform a test so that the current number of hours are recorded, and then perform another test when you receive it back. If you are said hard working person, leave the laptop on as much as possible.
Apparently, most USB/Firewire caddies/enclosures do not pass the S.M.A.R.T. information, therefore you cannot access the relevant attributes. You need to connect the hard disk on the IDE/SCSI/etc channel.

Permanent link to this article: https://blog.simos.info/for-how-long-have-i-been-using-my-computer/

2 comments

    • Panos on February 17, 2007 at 18:05
    • Reply

    S.M.A.R.T. function in 99% of the computers is coming OFF from the BIOS. That means you cannot track anything. The easiest way to find how old a PC is, is to check the dates of the folders created under c:\windows and c:\windows\system32 or c:\documents and settings.

    If it has being used sparingly the browser history will be near empty, as the coockies too.

  1. It’s not precise to give a figure such as 99%. This implies that you have checked at least 100 computers and you found that only one was working. It is preferred to say something along the lines of “the vast majority of the computers that I came across”.

    Personally the hard disks that I came across had S.M.A.R.T. working and there was data to extract. Perhaps this is a regional thing.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.