I have many small files (20 millions) with xattr on XFS drives. The average size of files is around 20KB and the average size of xattr is about 512 bytes.
Because I would like to move them to ext4, I tested to copy a part of these files into ext4 (with inode size 512 and 1024) and XFS drives.
I formatted 3 drives with the following options respectively:
# mkfs.ext4 -i 8192 -I 512 /dev/sde1 # mkfs.ext4 -i 8192 -I 1024 /dev/sdf1 # mkfs.xfs -f -i size=1024 /dev/sdg1
And copied about 30GB small files by cp -r --preserve=mode,ownership,timestamps,xattr
The result is as follows:
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sde1 133654640 37164884 89360916 30% /srv/node/sde1 # ext4 -I 512 /dev/sdf1 124741744 36645652 80967252 32% /srv/node/sdf1 # ext4 -I 1024 /dev/sdg1 142507224 31020968 111486256 22% /srv/node/sdg1 # XFS
ext4 uses much more blocks than XFS in both cases. What makes these difference? How can I use ext4 not wasting disk space?