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 sales­man 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 smart­mon­tools pack­age. Espe­cially since I decided to keep my old hard disk that sits next to me.
Modern hard disks sup­port a fea­ture called Self-​Monitoring, Ana­lysis, and Report­ing Tech­no­logy (S.M.A.R.T.), which helps make them more reliable.

One of the data recor­ded by S.M.A.R.T. is the total number of hours a hard disk has been in oper­a­tion. This is the S.M.A.R.T. attrib­ute 09 called Power-​On Hours (POH). When your com­puter is on, your hard disk is on as well, there­fore you can get the total number
of hours your com­puter has been on. Let’s see how we put all of these in action.

You need to install the smart­mon­tools pack­age, avail­able from the stand­ard Ubuntu repositories.

  1. Start System/Administration/Synaptic Pack­age Man­ager and search for smart­mon­tools. Select the pack­age for install­a­tion and click to Apply.
  2. Assum­ing your hard disk cor­res­ponds to device /dev/hda, run the com­mand sudo smart­ctl –all /dev/hda on a ter­minal window.

You will get a long list of inform­a­tion and attrib­utes. Wade through the output and notice the attrib­ute 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 oper­a­tion 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 man­u­fac­tur­ers meas­ure the time in minutes or seconds, so you need to con­vert accord­ingly.
Other inform­a­tion you may extra from S.M.A.R.T. include the tem­per­at­ure of the hard disk. The tem­per­at­ure 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 per­form self-​tests on your hard disk in order to check if it is about to fail. In S.M.A.R.T. ter­min­o­logy there are short (1min dur­a­tion) and long (30min dur­a­tion) tests, and the last five res­ults are saved in the hard disk non-​volatile memory. The entry includes the number of hours the hard disk has been in oper­a­tion as explained above. There­fore, when you loan a laptop to a hard work­ing person that has to finish an essay, you can per­form a test so that the cur­rent number of hours are recor­ded, and then per­form another test when you receive it back. If you are said hard work­ing person, leave the laptop on as much as pos­sible.
Appar­ently, most USB/Firewire caddies/enclosures do not pass the S.M.A.R.T. inform­a­tion, there­fore you cannot access the rel­ev­ant attrib­utes. You need to con­nect the hard disk on the IDE/SCSI/etc channel.

One Response to “For how long have I been using my computer?”

  1. S.M.A.R.T. func­tion in 99% of the com­puters is coming OFF from the BIOS. That means you cannot track any­thing. The easi­est way to find how old a PC is, is to check the dates of the folders cre­ated under c:\windows and c:\windows\system32 or c:\documents and set­tings.

    If it has being used spar­ingly the browser his­tory will be near empty, as the coock­ies too.

  2. It’s not pre­cise to give a figure such as 99%. This implies that you have checked at least 100 com­puters and you found that only one was work­ing. It is pre­ferred to say some­thing along the lines of “the vast major­ity of the com­puters that I came across”.

    Per­son­ally the hard disks that I came across had S.M.A.R.T. work­ing and there was data to extract. Per­haps this is a regional thing.

Discussion Area - Leave a Comment