1

I'm trying to display a file is creation time. I've been searching and I found out that under ext4 file systems this is something indeed possible to get and it's stored as crtime.

As you can see in my partition table, /dev/sda3 uses ext4:

Number  Start   End    Size    Type      File system  Flags
 1      1049kB  106MB  105MB   primary   ntfs         boot
 2      106MB   250GB  250GB   primary   ntfs
 3      250GB   251GB  1074MB  primary   ext4
 4      251GB   500GB  249GB   extended
 5      251GB   500GB  249GB   logical                lvm

So, I'm using /dev/sda3 as my device in debugfs command, like:

sudo debugfs -R 'stat bruno/aulas/ic/praticas/fc.url' /dev/sda3

However, I allways get this error:

debugfs 1.42.12 (29-Aug-2014)
bruno/aulas/ic/praticas/fc.url: File not found by ext2_lookup 

And the same applies when using the file's inode number:

stat -c %i aulas/ic/praticas/fc.url 
919916

sudo debugfs -R 'stat <919916>' /dev/sda3
debugfs 1.42.12 (29-Aug-2014)
stat: Illegal inode number while reading inode 919916

Now, sorry if I'm wrong, from the partition table I'm almost sure that I should be looking inside /dev/sda4 (since it's the one with the correct /home size), but I don't have a fs defined there, so I get this error (obviously I think):

sudo debugfs -R 'stat <919916>' /dev/sda4
debugfs 1.42.12 (29-Aug-2014)
/dev/sda4: Attempt to read block from filesystem resulted in short read while opening filesystem

So, can someone explain me what I'm doing wrong here? I'm a bit confused really, I'm not acquainted with fedora's partition scheme yet too..

Edit:

It doesn't work on sda5 too:

sudo debugfs -R 'stat <919916>' /dev/sda5
debugfs 1.42.12 (29-Aug-2014)
/dev/sda5: Bad magic number in super-block while opening filesystem
stat: Filesystem not open

lsblk:

lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 465.8G  0 disk 
├─sda1            8:1    0   100M  0 part 
├─sda2            8:2    0 232.8G  0 part 
├─sda3            8:3    0     1G  0 part /boot
├─sda4            8:4    0     1K  0 part 
└─sda5            8:5    0 231.9G  0 part 
  ├─fedora-swap 253:0    0     8G  0 lvm  [SWAP]
  ├─fedora-root 253:1    0    50G  0 lvm  /
  └─fedora-home 253:2    0 173.9G  0 lvm  /home
sdb               8:16   0 465.8G  0 disk 
└─sdb1            8:17   0 465.8G  0 part 
sr0              11:0    1  1024M  0 rom  

mount:

mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=2009528k,nr_inodes=502382,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mapper/fedora-root on / type ext4 (rw,relatime,seclabel,data=ordered)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime,seclabel)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
/dev/sda3 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel,data=ordered)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/42 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=404292k,mode=700,uid=42,gid=42)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=404292k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
yat0
  • 113
  • Try issuing lsblk and mount, and adding their output to your question. – Tom Hunt Oct 09 '15 at 16:19
  • You don't want /dev/sda4, that's an extended partition. If the sizes are right, your file will be on /dev/sda5. Please let me know if sudo debugfs -R 'stat <919916>' /dev/sda5 works. If so, I will close this as a duplicate of Birth is empty on ext4. By the way, to find out which filesystem a file is on, run df /path/to/file. – terdon Oct 09 '15 at 16:21
  • done :) @TomHunt – yat0 Oct 09 '15 at 16:24
  • It doesn't work either @terdon , I've edited the question with the test – yat0 Oct 09 '15 at 16:25
  • 1
    OK, your /dev/sda5 isn't mounted (or is one of the /dev/mapper/fedora- things). What do you get for df bruno/aulas/ic/praticas/fc.url? – terdon Oct 09 '15 at 16:26
  • @don_crissti yeah, just noticed and edited my last comment. I don't know how this would work with lvm. I guess that might be the issue. – terdon Oct 09 '15 at 16:28
  • It worked!! Many thanks to both of you, type an answer @don_crissti , I would be glad to accept it. – yat0 Oct 09 '15 at 16:30

0 Answers0