This post explains how to find the OS version which was first installed on a CentOS/RHEL system.
CentOS/RHEL 6
Run grep -m1 “label =” /var/log/anaconda.storage.log to find the original installation OS version.
Current version:
# cat /etc/redhat-release CentOS Linux release 6.10
Original installation version:
# grep -m1 "label =" /var/log/anaconda.storage.log label = EL6.8_x86_64_Disc_1_20160518 size = 0 targetSize = 0
The above shows original installation was CentOS 6.8.
CentOS/RHEL 7 and above
For CentOS/RHEL 7
Run grep -m1 inst.stage2=hd:LABEL /var/log/anaconda/syslog to find the original installation OS version.
Current Version:
# cat /etc/redhat-release CentOS Linux release 7.9
Original installation version:
# grep -m1 inst.stage2=hd:LABEL /var/log/anaconda/syslog 08:12:14,153 INFO kernel:[ 0.000000] Command line: initrd=initrd.img inst.stage2=hd:LABEL=EL-7.2\x20Server.x86_64 quiet BOOT_IMAGE=vmlinuz
The above shows original installation was CentOS 7.2.
For CentOS/RHEL 8
Current Version:
# cat /etc/redhat-release CentOS Linux release 8.3
Original installation version:
# grep -m1 inst.stage2=hd:LABEL /var/log/anaconda/syslog 09:07:12,619 INFO kernel:Command line: BOOT_IMAGE=vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=EL-8-0-0-BaseOS-x86_64 quiet
The above shows original installation was CentOS 8.0.