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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-15-2016, 08:47 AM
|
#1
|
Member
Registered: Oct 2007
Posts: 283
Rep:
|
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?
|
|
|
10-15-2016, 09:43 AM
|
#2
|
Moderator
Registered: Aug 2002
Posts: 26,816
|
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.
|
|
|
10-15-2016, 10:23 AM
|
#3
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,982
|
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!

|
|
|
10-15-2016, 02:52 PM
|
#4
|
Moderator
Registered: Mar 2008
Posts: 22,361
|
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.
|
|
|
10-15-2016, 04:40 PM
|
#5
|
Member
Registered: Apr 2012
Distribution: Gentoo
Posts: 616
Rep: 
|
Power_On_Hours parameter may be used as an indicator
Code:
smartctl -x /dev/sda | grep Power_On_Hours
|
|
|
10-18-2016, 03:55 AM
|
#6
|
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,572
|
Quote:
Originally Posted by jefro
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 
|
|
|
10-18-2016, 07:32 AM
|
#7
|
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,850
|
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
|
|
|
10-19-2016, 10:19 AM
|
#8
|
Member
Registered: Oct 2007
Posts: 283
Original Poster
Rep:
|
I have the impression that any utility I install will only record the hours following its installation?
|
|
|
10-19-2016, 10:46 AM
|
#9
|
Moderator
Registered: Aug 2002
Posts: 26,816
|
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.
|
03-06-2023, 03:42 AM
|
#10
|
LQ Newbie
Registered: Apr 2011
Posts: 6
Rep:
|
Quote:
Originally Posted by michaelk
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.
|
|
|
All times are GMT -5. The time now is 11:08 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|