Search code examples
linuxfilesystemsfilesizeinodeext4

Ext4 filesystem i_size_lo i_size_high difference?


I want to know the difference between "i_size_lo" and "i_size_high"?

Ext4 original article


Solution

  • According to the linked documentation, "i_size_lo" is the "Lower 32-bits of size in bytes.", while "i_size_high" is "Upper 32-bits of file/directory size".

    This means that the total size of the file is 64bits and the value was split between two 32bit fields. To get size of the file, need to do a little math:

    uint64_t size = (inode.i_size_high << 32) + inode.i_size_lo