banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

When Was My System Installed?

by agmg (Antonis Komis)

When was my system installed? Good question. I was wondering the same thing lately, so I've been searching for ways to determine the installation date of my PCLinuxOS system. For the purposes of this article, I will use a recent PCLinuxOS installation under VirtualBox, which I know I have installed on January 22, 2013. Let's see if we can confirm that date.


Log files

The first thought would be to check the various log files. The problem with this method, though, is that log files are rotated in a timely manner to prevent them from growing. This unbounded growing of log files has several disadvantages:

  • Larger files are harder to manipulate.
  • File systems run out of space.
  • The information you log may constitute personal data.

Log rotation involves the regular (nightly or weekly, typically) moving of an existing log file to some other filename and starting fresh with an empty log file. After a certain period, the old log files get thrown away.

In a rolling distribution like PCLinuxOS, which can go on for months or even years without a reinstallation, it may be hard or impossible to find very old log files unless you are willing to disable log rotation and have all the disadvantages mentioned above.


The stat command

The rolling nature of PCLinuxOS doesn't help us much in our effort to find the actual install date. The system is updated regularly, which means that almost everything could be changed on every update. One of the things that's least likely to be changed is the /lost+found directory. You can use the stat command on that folder, from the terminal:


[agmg@localhost ~]$ stat /lost+found
 File: `/lost+found'
 Size: 16384           Blocks: 32         IO Block: 4096   directory
Device: 801h/2049d      Inode: 11          Links: 2
Access: (0700/drwx------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-01-22 16:42:42.205851899 +0200
Modify: 2013-01-22 17:49:44.000000000 +0200
Change: 2013-01-22 17:49:44.000000000 +0200
Birth: -

The results tell me that the system was installed on January 22, 2013. Yet, there is something that you should keep in mind: the stat command will not give you accurate information if you have reformatted your hard drive, restored the system from a backup or had filesystem issues at some point. Also, the system time has to be set correctly during installation for this method to work properly.


tune2fs

The same conditions regarding the filesystem and the proper setting of system time during installation also apply to the next command, which makes use of the tune2fs. The command has to be issued as root from the terminal, and will show us when the filesystem was created:


[root@localhost agmg]# tune2fs -l /dev/sda1  | grep cr
Filesystem created:       Tue Jan 22 17:49:44 2013

A similar command using tune2fs, with a more complicated syntax, is the following:


[root@localhost agmg]# tune2fs -l $(df -P / | awk 'NR==2 {print $1}') | sed -n 's/^.*created: *//p'
Tue Jan 22 17:49:44 2013

In both cases, the results agree on the date that we got previously, using the stat command


passwd

Let's use one more trick to verify our results. During PCLinuxOS installation, there are two user accounts created: the root account and the first user account. The trick is to check when was the password of root or the first user account set, provided that you haven't changed it and (again) that the system time was properly configured at the time of installation.


[root@localhost agmg]# passwd -S root 
root PS 2013-01-22 0 99999 7 -1 (Password set, blowfish crypt.)

[root@localhost agmg]# passwd -S agmg agmg PS 2013-01-22 0 99999 7 -1 (Password set, blowfish crypt.)

Once more, we see the same date: January 22, 2013. So, the system must have been installed on that date and never reinstalled. Great!


Conclusion

As you can see, there are a few ways to see when your system was installed. None of them is perfect, because each one has certain conditions that must be met for that method to give accurate results.

But if those conditions are met, then you could get a good picture about how much time your stable, rolling installation of PCLinuxOS has been up and running. If you are a typical user that doesn't mess up the system too much and keeps updating it regularly, this time could be quite long!



Previous Page              Top              Next Page
Copyright (c) 2013, The PCLinuxOS Magazine. All Rights Reserved.