filesystemsinodexfs

Xfs file size, inode size and block size


ll /srv/node/dcodxx/test.sh
-rw-r--r--. 1 root root 7 Nov  5 11:18 /srv/node/dcodxx/test.sh

The size of the file is shown in bytes. This file is stored in an xfs filesystem with block size 4096 bytes.

xfs_info /srv/node/sdaxx/
meta-data=/dev/sda               isize=256    agcount=32, agsize=7630958 blks
         =                       sectsz=4096  attr=2, projid32bit=0
data     =                       bsize=4096   blocks=244190646, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=119233, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Does this mean that a block can house more than one file, if not what happens to the remaining bytes (4096-7)? Also, where is the 256 bytes reserved for an inode stored, if it stored in the same block as the file, shouldn't the file size be larger(256+7)?


Solution

  • Does this mean that a block can house more than one file, if not what happens to the remaining bytes (4096-7)?

    A block cannot contain more than one file. If a file is bigger than one block, multiple blocks are used.

    Modern filesystems like XFS have a functionality called "inline", where files small enough (no more than 60 bytes) can be stored in the inode, in the space taken to store pointers to the blocks.

    where is the 256 bytes reserved for an inode stored, if it stored in the same block as the file, shouldn't the file size be larger(256+7)?

    Inode information is stored in the inode table.