I need to get date and time when a file was created. The file is stored at ext4 filesystem so the information is available in the i-node and I use debugfs to read this information:

# debugfs -R "stat <3922>" /dev/sda1 | grep crtime
debugfs 1.43-WIP (18-May-2015)
crtime: 0x5b646acd:b0175ac8 -- Fri Aug  3 14:46:37 2018

That works fine but the command sometimes fails:

# debugfs -R "stat <3922>" /dev/sda1
debugfs 1.43-WIP (18-May-2015)
/dev/sda1: Block bitmap checksum does not match bitmap while reading block bitmap
stat: Filesystem not open

The next debugfs execution returns correct data.

What does exactly mean the error Block bitmap checksum does not match bitmap while reading block bitmap ?

  • Modern versions of the stat utility (from coreutils) will show you the birth time, too. – Mark Plotnick Aug 3 '18 at 15:47
  • @MarkPlotnick: Unfortunately it is an embedded linux, that is not easy to upgrade. – Zaboj Campula Aug 3 '18 at 17:15
  • Do you have a C compiler? github.com/torvalds/linux/blob/master/samples/statx/… will do almost the same thing as the stat utility. – Mark Plotnick Aug 3 '18 at 18:00
  • @MarkPlotnick: I have a C compiler but statx is not an option because it was added to the linux kernel 4.11 and I have 3.10. – Zaboj Campula Aug 5 '18 at 11:01
  • 1
    If your filesystem sits on top of an lvm volume, you could try making a snapshot and then run debugfs on the snapshot. That should reduce, but not eliminate, inconsistencies caused by examining a constantly changing filesystem. – Mark Plotnick Aug 6 '18 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.