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?

Pandya
  • 23,898
  • 29
  • 92
  • 144
Tim
  • 98,580
  • 191
  • 570
  • 977
  • Have you ever seen `stat` output `ext4`? Probably is just doesn't care. – Hauke Laging Jan 22 '16 at 03:18
  • I have seldom used `stat`, and I haven't seen `stat` output `ext4`. – Tim Jan 22 '16 at 03:34
  • you'[re](http://unix.stackexchange.com/questions/34623/how-to-tell-what-type-of-filesystem-youre-on#comment444069_34636) right I recommend `df -T` instead. – Pandya Jan 22 '16 at 08: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 09:07

1 Answers1

2

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
Pandya
  • 23,898
  • 29
  • 92
  • 144