Thursday, March 05, 2009

Determining the age of a Linux installation.

Have you ever been curious of how old your current Linux installation is?

Three indirect ways of finding this out follow:

  1. Retrieve info from the filesystem (ext2-ext3 only).

    Provided your installation has an ext[23] filesystem,
    run as root:
    dumpe2fs -h <device> |grep "Filesystem created"
    Usually, at least the boot partition is of this type.

  2. Investigate the dates of files in the root directory.

    Run the command
    ls -lu /
    This will show you the access times of the contents of the root directory. In most cases directories like /bin should be unmodified since their creation during the system install process.

  3. Investigate system log files.

    All Linux systems keep log files. They place them in the same directory, usually in /var/log/. Pick a log, like syslog or wtmp, and look the first lines of the file. A date of the log entry will be available. Note though, that most distributions rotate and compress log files periodically. In this case, you need to look up this information in the oldest log archive. Also, old log archives may be automatically deleted, so finding the installation log messages is impossible in this case.
The age of my current Gentoo installation is 3 years 9 months:

dumpe2fs -h /dev/hda2|grep
"Filesystem created"
dumpe2fs 1.39 (29-May-2006)

Filesystem created: Thu Jun 9 16:09:37 2005