1
$sudo blkid
/dev/sda1: UUID="F959-61DE" TYPE="vfat" PARTUUID="950b18a0-1501-48b4-92ef-ba1dd15aaf21"
/dev/sda2: UUID="6dfcfc23-b076-4eeb-8fba-a1261b4ea399" TYPE="ext4" PARTUUID="ddc69ee8-40b0-49c9-9dcb-0b9064caca7d"
/dev/sda3: UUID="fec0af18-d28e-4f2a-acb7-6380ddee3dc2" TYPE="ext4" PARTUUID="e19628dc-c04a-4c9d-a3c6-469511e89480"
/dev/sda4: UUID="a6f7669b-6e86-432a-b91c-f39780c849ac" TYPE="swap" PARTUUID="e45cf647-3d78-4fea-a950-022a3ae9b4e0"
/dev/sda5: UUID="5a75937f-8a83-44a9-b5c5-502b7e3884f2" TYPE="ext4" PARTUUID="3e086aff-105f-48b3-a384-1eb1d18c6fb3"
/dev/sda6: UUID="04460cd2-a1bb-4a3e-94df-1ad10080f356" TYPE="ext4" PARTUUID="d37fdea8-a386-4f6f-8016-fa2764a71b60"

$pwd
/home/milad

$touch a
$ls -i a
3935203 a

$sudo /sbin/debugfs/ -R 'stat 3935203' /dev/sda6
debugfs 1.44.5 (15-Dec-2018)
3935203: File not found by ext2_lookup 

How to get birth date my file in ext4 partition drive?

Thanks for helping

1 Answers1

3

debugfs’s stat command expects a path name, or an inode number “quoted” using angle brackets; you might as well use stat milad/a instead:

sudo /sbin/debugfs -R 'stat milad/a' /dev/sda6

The file path is relative to the root of the file system; since that is mounted at /home, /home/milad/a becomes milad/a.

If your version of the stat utility is recent enough, you can use that instead of debugfs: run

stat a

from your shell, and you’ll see its birth time (if your kernel is also recent enough to record it and make it available).

Stephen Kitt
  • 434,908
  • Stephen is right but you also could have done: sudo /sbin/debugfs/ -R 'stat <3935203>' /dev/sda6. Just added < and > in your query as linux thinks you are parsing a file path and not an inode number. – Guillaume H Nov 14 '22 at 02:38