Who is right about inodes? df or tune2fs?

5,347

df should be correct. tune2fs inode count is not checking the superblock kept in memory so it's unreliable for mounted volumes. If you unmount /dev/mapper/data_vg-data_lv and check with tune2fs it should show the same values as df -i

Share:
5,347

Related videos on Youtube

Pozinux
Author by

Pozinux

I though that a good way of learning was to participate to this very nice community as much as I can. Please pardon my rusty english because I'm French. ^^

Updated on September 18, 2022

Comments

  • Pozinux
    Pozinux over 1 year

    On my Redhat 6.5, I get two different results on free inodes.

    Using df :

    [root@xxxx ~]# df -i /dev/mapper/data_vg-data_lv 
    Filesystem                   Inodes IUsed   IFree IUse% Mounted on 
    /dev/mapper/data_vg-data_lv 2555904 72422 2483482    3% /data/cfa000/x1/data 
    

    Using tune2fs :

    [root@xxxx ~]# tune2fs -l /dev/mapper/data_vg-data_lv | grep -i inode 
    ...
    Inode count:              2555904 
    Free inodes:              846816 
    ...
    

    Can this situation be normal? If not, what could be the problem?

    • Pozinux
      Pozinux over 6 years
      I'm connected through ssh on this server so I'm sure. What do you mean by latest erratas please?
  • Pozinux
    Pozinux over 6 years
    Ok I'm going to unmount it and test later on. However, I have another server which is the same as this one with same FS mounted and both df -i and tune2fs -l show the same value. Also, the difference inode count seems so big.
  • HoD
    HoD over 6 years
    Are you using different filesystems on the two servers? As I understand it the ext4 superblock is only written to disk when unmounting, but it's possible different filesystems update sooner.