0

with the command stat file.txt I get

Access: 2024-06-10 14:55:36.254879000 +0300 Modify: 2024-06-10 14:55:36.254879000 +0300 Change: 2024-06-10 14:55:36.254879000 +0300 Birth: - 

I work in a cluster thus I am not a sudo and I can't execute any sudo command. Note that the OS is very old (as you can see) thus statx can't work for me.

$ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.9.2009 (Core) Release: 7.9.2009 Codename: Core 

Thus, I would like to ask if there is any way to view the birth time.

Thanks

3
  • 1
    Please edit your question to indicate what filesystem is used on the cluster. Commented Jun 10, 2024 at 12:39
  • 2
    Does this answer your question? How can get the creation date of a file? Commented Jun 10, 2024 at 12:44
  • @AdminBee hello, my friend unfortunately no. Indeed, it is one of the questions I viewed before asking my question. Thanks. Commented Jun 10, 2024 at 12:56

1 Answer 1

1

If stat can't read the birth time, it's either not stored in the file system at all (that is normal for many file systems!), or your old kernel's stat simply doesn't know where to get it. Check with your administrator that you are not trying to get data that simply never got stored!

Note that the OS is very old (as you can see) thus statx can't work for me

yep, centOS (and RHEL) 7.9 should have only Linux 3.10, and that increases the likelihood of your system using a file system that doesn't even store the birth time. (RHEL admins are typically concerned with reliability, and hence tend to choose their file systems conservatively. Try df -h -T to see whether your system tells you the type of your file system. XFS, for example, prior to 2020 simply didn't have the field, nor, if I remember correctly, did ext3, or ReiserFS).

In fact, as said in the answer you've been linked to, you simply have no way of asking the kernel for this information as user. You're out of luck – you need someone with access to debugfs (i.e., root privileges) to ask your kernel.

Edit: now in the comment you mention this file system is NFS.

You will need NFSv4 to transport the birth date file attribute at all (you probably are using that) and a kernel at least 5.17, which CentOS 7.9 does not have.

So, what you want is impossible on your platform. Nothing is getting the birth date from the NFS data and presenting it to userland.

7
  • AFAICT birth time was added to XFS in Linux in 2013. Commented Jun 10, 2024 at 20:02
  • @StéphaneChazelas I thought that was an XFS v5 thing? And that came with Linux 4.2 (????? I think), and hence wouldn't be in RHEL 7 Commented Jun 10, 2024 at 20:03
  • Sorry, that commit was when fields were reserved in the inode, I'll dig for the commit where that's actually functional. Commented Jun 10, 2024 at 20:04
  • Actually looks like that was functional, but there may not have been an API to retrieve it. V5 might have been when you could retrieve it with statx(). Commented Jun 10, 2024 at 20:10
  • @MarcusMüller Filesystem Type Size Used Avail Use% Mounted on ...................... nfs ................................................................... (i have replaced the real parameters with dots) Commented Jun 11, 2024 at 8:10

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.