Date of a FreeBSD installation

How to know when FreeBSD system was installed?
For example:
Bash:
# stat -f '%SB %N' /
May 12 11:33:00 2022 /
#
But I remember that my system was installed in July, not earlier.
 
How to know when FreeBSD system was installed?
For example:
Bash:
# stat -f '%SB %N' /
May 12 11:33:00 2022 /
#
But I remember that my system was installed in July, not earlier.

Your stat shows when / was created, the date the release was built.

// edit:
As VladiBG says,
//
/var/log/bsdinstall_log is likely the first new file written, or you can list /etc in time order to see the first date after the build date:

% ls -lrt /etc | less
 
Found another solution to know birthdate of the system today
Code:
vovas@tank:~ $ stat -x /home
File: "/home"
Size: 8            FileType: Symbolic Link
Mode: (0755/lrwxr-xr-x)         Uid: (    0/    root)  Gid: (    0/   wheel)
Device: 1707236475,1254490208   Inode: 18782    Links: 1
Access: Fri Jul 15 21:22:09 2022
Modify: Fri Jul 15 21:22:09 2022
Change: Fri Jul 15 21:22:09 2022
Birth: Fri Jul 15 21:22:09 2022
or you can list /etc in time order to see the first date after the build date
It's not correct way
Code:
vovas@tank:~ $ ls -lrt /etc | less
total 520
drwxr-xr-x  2 root  wheel         2 May 12  2022 rc.conf.d
drwxr-xr-x  6 root  wheel         6 May 12  2022 periodic
drwxr-xr-x  2 root  wheel         2 May 12  2022 jail.conf.d
If you check when 13.1-RELEASE was upload to download access, you'll see same date. It's not date of installation on your server/pc. It's looks like date of birth 13.1-RELEASE
2023-01-05_14-15-11.png
 
ls -lt /var/log, look at the last file listed. Typically it will be bsdinstall_log, on my systems the date on bsdinstall_log matches the line "Began Installation at" inside it (at least for the month day year).

Basically VladiBG and smithi have said.
Since most of the files on the install media are typically in an archive format of some kind and just get unarchived to the install media, they typically have the timestamps of when they were created on the original system (basically tar/untar preserves the original timestamps of the files), so that's why they match the install media.

I think the proper method is look at the bsdinstall_log rather than trying to determine it from files/directories by using stat. What if someone did not have /home as a symlink after install and added it 6 months later? You won't realize that unless you have something to compare against.

That's a beauty of ZFS: zpool history gives you details on a pool, starting with a timestamped "zpool create" command.
 
// edit:
As VladiBG says,
//
/var/log/bsdinstall_log is likely the first new file written, or you can list /etc in time order to see the first date after the build date:

% ls -lrt /etc | less

It's not correct way
Code:
vovas@tank:~ $ ls -lrt /etc | less
total 520
drwxr-xr-x  2 root  wheel         2 May 12  2022 rc.conf.d
drwxr-xr-x  6 root  wheel         6 May 12  2022 periodic
drwxr-xr-x  2 root  wheel         2 May 12  2022 jail.conf.d
If you check when 13.1-RELEASE was upload to download access, you'll see same date. It's not date of installation on your server/pc. It's looks like date of birth 13.1-RELEASE

Yes, that's what I meant: you have to scroll down past those files to find the first date in /etc AFTER the OS build date.

Sorry if I wasn't clear. Mer's post covered it better anyway.

cheers
 
  • Like
Reactions: mer
Back
Top