0

OS is Debian.

Not asking about uptime of course, but I would like to determine when vm was created and/or first booted.

Normally you can do something like: stat / and check birth time, but for a kvm vm it just shows "-". (I've seen this issue on bare metal systems as well sometimes, not sure why)

What is a foolproof way to check when a server was created? Is this even possible? Wondering about kvm vms, but would be interested in a solution for bare metal systems that for one reason or another show "-" for birth time.

Edit: I was assuming that KVM vms are created from images. I realize now that it's possible to create KVM vms from an installer, but for this question, assume image. Is this possible to determine in this case?

cat pants
  • 435
  • Possibly a duplicate of this?: https://unix.stackexchange.com/questions/50177/birth-is-empty-on-ext4 – Jas Jan 04 '24 at 09:18

1 Answers1

0

Your installation has the root filesystem set up using a filesystem type that does not track creation times.

On any Debian-based distribution, the OS installer will normally leave its logs at /var/log/installer/, and nothing generally touches them afterwards, so try:

ls -lt --full-time /var/log/installer/

With other distributions, if you can find a file that's created by the OS installer and not modified afterwards, you can use a similar command with it.

For example, on RHEL and related distributions, the installer will typically create a /root/anaconda.ks file at end of installation. If it is still present, its timestamp will identify the installation time, assuming the system clock had the correct time at the time of installation.

telcoM
  • 96,466