LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-15-2016, 08:47 AM   #1
Brant
Member
 
Registered: Oct 2007
Posts: 281

Rep: Reputation: 35
How can I tell how many hours a computer has been running in its life?


I would like to be able to tell how much time my computers have spent running. I am not interested in how long they have run before needing to be rebooted—I tend to rotate from job to job, and they all spend more time shut down than running.

I realize that this raises the philosophical question, "What is a computer?". CPU, motherboard, HDD? It would be easy to treat a tower as a kind of "grandfather's axe—a new head, and three new handles, and as good as the day it was made". Looking online, it seemed that an easy measure would be the total number of hours the HDD had been running.

I also see that this information would be unlikely to be very useful as a predictor of how much longer a computer might last. . .

I am running Linux Mint Cinnamon 17.3, and looked at the Disk Usage Analyzer, which didn't seem to offer that information. Is there a command? And if so, would it give a global total, or only a total for the usage under the current distribution?
 
Old 10-15-2016, 09:43 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
uptime is reset at boot so you need something like uptimed to track totals. This would only provide data since OS instalation. I have never seen any BIOS hour meter in a desktop PC which is why using HDD data is the next best approximation.
 
Old 10-15-2016, 10:23 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member response

Hi,

I agree with michaelk that the use of 'hdparm' would be a good indicator for the system drive to show the hours for a System overall. That would be if that HDD was the original system drive.
Quote:
From 'man hdparm';
hdparm - get/set SATA/IDE device parameters

SYNOPSIS
hdparm [options] [device ...]

DESCRIPTION
hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS "libata" subsystem and the older
IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support "SAT" (SCSI-ATA Command Translation) and therefore
may also work with hdparm. E.g. recent WD "Passport" models and recent NexStar-3 enclosures. Some options may work correctly only with
the latest kernels.
Hope this helps.
Have fun & enjoy!
 
Old 10-15-2016, 02:52 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
Some advanced bios makers might have logs for some clues. Some of the lights out boards might have logs. Unfortunately they can be cleared.

Someone said NASA bought 1000 of this special built computer for use on a mission. I asked the manager why would they buy 1000. He said that the computer maker tested them but NASA would put the most demanding tests. After many of them failed they'd select from the remaining ones assuming that they have a great chance of working. So, a computer that has been running longer may in fact be better.
 
Old 10-15-2016, 04:40 PM   #5
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
Power_On_Hours parameter may be used as an indicator
Code:
smartctl -x /dev/sda | grep Power_On_Hours
 
Old 10-18-2016, 03:55 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by jefro View Post
So, a computer that has been running longer may in fact be better.
But good luck restarting it if the power fails, at that point electrical and thermal shock will be your enemy
 
Old 10-18-2016, 07:32 AM   #7
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Simple matter of sripting, isn't it? (and some kinda-related trivia)

(Argh! Make that "scripting".)

If the system is brand new, you can keep track of the uptime and accumulate that with some scripting that runs at startup and shutdown. However, accounting for uptime that ends in a kernel panic or a power failure won't be as easy. You'd need to run a task that updates a system uptime accumulator every minute in, say, a cron job and use that to update an overall uptime accumulator stashed in a file somewhere.

Trivia: Many "large" computer systems used to have a actual "Hobbs meter" (you GA pilots will know what this is) will that recorded how long the system had been powered up and these would be rare on a system that wasn't installed in multiple 19" racks. I never asked the field service guys what they used this for. I assume it gave them an idea as to when certain preventive maintenance activities should be scheduled.

Last edited by rnturn; 10-18-2016 at 07:33 AM. Reason: Can't type this morning
 
Old 10-19-2016, 10:19 AM   #8
Brant
Member
 
Registered: Oct 2007
Posts: 281

Original Poster
Rep: Reputation: 35
I have the impression that any utility I install will only record the hours following its installation?
 
Old 10-19-2016, 10:46 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
As far as I know a correct statement and stated above without a hour meter as described above there is nothing that tracks real run time.
 
1 members found this post helpful.
Old 03-06-2023, 03:42 AM   #10
marculix
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Rep: Reputation: 1
Quote:
Originally Posted by michaelk View Post
As far as I know a correct statement and stated above without a hour meter as described above there is nothing that tracks real run time.
Hi chaps,

Not quite true that there is nothing that tracks real run time.

I developed an hourmeter solution 23 years ago for exactly that purpose.

https://marcgloor.github.io/hourmeter.html

For instance, the current uptime and runtime of my cloud server:
Code:
user@lugano$ uptime
 10:52:32 up 40 days,  8:01,  1 user,  load average: 0.00, 0.00, 0.00

user@lugano$ hm
hm> 48114.8h
I generally install this commmand "hm" right after setting-up either a workstation or a server.

Enjoy.

Cheers
Marc

Last edited by marculix; 03-06-2023 at 08:11 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
3 hours less life for mp3 player + backtrack 5 linux altdrgz Linux - Software 8 12-17-2013 04:55 PM
Computer become hang when left idle for few hours sauravrukd Linux - Software 2 11-23-2011 07:04 AM
Getting 4+ hours of battery Life with Linux? stukpixel Linux - Laptop and Netbook 1 08-22-2008 02:53 AM
My computer is taking more than 4 hours to install linux sahusandi Linux - Software 5 09-14-2007 11:51 PM
How many hours a day on your computer? DanTaylor General 24 04-05-2006 08:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration