Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm getting ready to reinstall my OS, but I'm wondering how long it's been cranking along.

Please list the OS and the best way to find out when it was born and for S&Gs how long yours has made it without being killed by you.

share|improve this question
1  
Should probably be a wiki. Others have answered the HOW, but to your HOW LONG question, I had a Win2K server with an uptime of 8+ years. It didn't do much (a specialized extranet firewall) and was quite hardened so not much running. Basically a glorified packet filter. –  squillman Jun 24 '09 at 14:33

8 Answers 8

up vote 12 down vote accepted

On Windows, run "systeminfo" at the command prompt. You're looking for "Original install date".

share|improve this answer
2  
systeminfo | find "Original Install Date: " Will give you exactly what you want. –  MathewC Jun 24 '09 at 14:54
1  
Hmm. This would indicate that my "new" laptop was built seven months ago, which it wasn't. The optimitic theory is that a ghosted image was built back then, and the pessimistic theory is that I've been given a recycled box. How do I tell which, without relying on the word of a potentially biased opinion? –  Philip Kelley Oct 28 '09 at 19:32
    
I can't think of a concrete way to tell. I would put money on it being when the image was built. –  tomfanning Nov 5 '09 at 11:09

On Windows NT-derived operating systems, you can find the installation date at:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate

The date is stored as a number of second elapsed since January 1, 1970.


For Linux installs on ext2 or ext3, I suppose you could get the creation date of the filesystem using the tune2fs command:

tune2fs -l <filesystem block device> | grep "Filesystem created"

I'm really not sure of a good way on Linux operating systems, since every distribution could do their own thing.


I have a Linux box running presently that does production work and was installed in February, 2004. Longest continuous uptime on that machine was a little over 2 years.

I have a Customer who is running a Windows NT Small Business Server 4.5 machine that was installed in late 1999. (They are also still using some of the Windows 98SE-based PCs that they bought at that time, as well.) They shut the machine down every day (don't ask-- they have a paranoia about fire and turn off most of the electricity in their building every night), so the uptime isn't radical. Surprisingly, it's still running on the same two (2) Western Digital "Enterprise" SCSI disks and HP DAT drive that it was purchased with.

share|improve this answer

On Mac OS X, the file

/var/log/OSInstall.custom

contains the original installation date, for example

Native install completed 2009-01-30 22:16:14 -0800.

So, this command shows the install date and time:

head /var/log/OSInstall.custom
share|improve this answer
    
Can you edit to add command line to pull that info from that file and echo it to the screen? –  MathewC Jun 24 '09 at 14:53

For Solaris (since at least version 8), check the install date of the SUNWsolnm package. It's the package containing the /etc/release file and won't be updated/patched.

   # pkginfo -l SUNWsolnm
   PKGINST:  SUNWsolnm
      NAME:  Solaris Naming Enabler
  CATEGORY:  system
      ARCH:  sparc
   VERSION:  10,REV=2008.03.24.13.19
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  Enable Solaris Name in /etc/release file
    PSTAMP:  re29796
  INSTDATE:  Jun 02 2008 17:01
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:        2 installed pathnames
                   1 shared pathnames
                   1 directories
                   1 blocks used (approx)
share|improve this answer

On a Unix you could look for the oldest /dev timestamp with,

 ls -lsrt /dev/* | head -1
share|improve this answer
1  
It won't help much on a modern system using udev, which creates devices dynamically at boot. –  wazoox Jun 24 '09 at 14:30

On the Ubuntu system I am currently using, you can find what you want at /var/log/installer. IIRC, the Fedora/RedHat installer also leaves log files somewhere in the installed system (feel free to edit this answer to add their location).

share|improve this answer
1  
Redhat and derivatives leave "anaconda-ks.cfg" and "install.log" in /root. One can look at their dates, but that could be misleading of some sort of cloning software was used or if those files were touched after the installed date. Also in Linux, older kernels are not removed by package managers. Generally, looking at the oldest kernels install date will tell you the OS install date. Again, it could be possible for a cloning software to screw this up. –  Not Now Jun 24 '09 at 15:53

Getting on over 8 years on a coupla Win2K boxes here too; there's one in particular I strongly suspect will outlive humanity and cockroaches. Since the advent of automatic updates continuous uptime is a thing of the past, but I've seen uptimes in the order of 600 days before.

share|improve this answer
    
I recall nearly shedding a tear when I had to reboot an NT 4.0 system w/ a 765 day uptime... smile –  Evan Anderson Jun 24 '09 at 16:34
    
We had a server with over 600 days of uptime, until I logged into it by mistake one day and installed something I shouldn't have and destroyed the only application it was running. Thankfully it wasn't a critical box, but it was sad to see it go. –  Mark Henderson Jun 24 '09 at 21:53

All OS's - check your documentation/CMDB.

Linux - I'm not sure there is a standard or even reliable way that will work for all distros, unless the installer of your distros leaves logs.

E.g. on our servers we use kickstart and we log the output from the %post section to /root/

You can try stuff like the ctime of the /etc or /root inodes, but they may have changed (though they are less likely to be changed than other dirs)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.