2

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 ?

Zaboj Campula
  • 1,116
  • 3
  • 15
  • 30
  • Modern versions of the `stat` utility (from coreutils) will show you the birth time, too. – Mark Plotnick Aug 03 '18 at 15:47
  • @MarkPlotnick: Unfortunately it is an embedded linux, that is not easy to upgrade. – Zaboj Campula Aug 03 '18 at 17:15
  • Do you have a C compiler? https://github.com/torvalds/linux/blob/master/samples/statx/test-statx.c will do almost the same thing as the `stat` utility. – Mark Plotnick Aug 03 '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 05 '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 06 '18 at 15:40
  • @MarkPlotnick: Good hint. Nevertheless it is not an LVM based filesystem. I did a workaround to run debugfs in a loop till it returns correct data but still want to know what is the error cause. – Zaboj Campula Aug 07 '18 at 05:49

0 Answers0