3

On Ubuntu 14.04, I am checking the ext4 filesystem for my home based on a file new in it:

$ stat -f new
  File: "new"
    ID: 38d4cd29e44142c6 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 144152970  Free: 79424314   Available: 72095994
Inodes: Total: 36626432   Free: 35430143

why does stat -f show the file system type is ext2/ext3 while my home filesystem type is ext4?

  • Have you ever seen stat output ext4? Probably is just doesn't care. – Hauke Laging Jan 22 '16 at 3:18
  • I have seldom used stat, and I haven't seen stat output ext4. – Tim Jan 22 '16 at 3:34
  • you're right I recommend df -T instead. – Pandya Jan 22 '16 at 8:56
  • 1
    Use blkid - it will hunt through the superblock looking at various flags to determine whether the filesystem is ext2, ext3, or ext4. – Mark Plotnick Jan 22 '16 at 9:07
1

Strictly speaking stat -f doesn't differentiate between ext2, ext3 and ext4. Instead, it just shows them as ext2/ext3 and probably ext2/ext3/ext4.

So, it is not good ideat to use stat -f to check specific ext type file-system. You can use df -T from coreutils for such purpose.

From manpage:

NAME
       df - report file system disk space usage

       -T, --print-type
              print file system type

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.