Linux ext4 "extents" attribute

I noticed the e attribute on several files/directories on Linux machines installed on ext4 filesystems.

[[email protected] ~]$ lsattr -d /bin
-------------e- /bin

According to chattr(1):

The ’e’ attribute indicates that the file is using extents for mapping the blocks on disk. It may not be removed using chattr(1).

In what way is this different, and more importantly, in what way is this detail significant -- specifically why is this detail important enough to be reported as a file attribute? Under what circumstances should I ever change my behavior based on the knowledge that this file "is using extents for mapping the blocks on disk"? Presumably this is something I need to know, otherwise it wouldn't be made so obvious, right?


Solution 1:

I think the extent flag is exposed as an attribute mainly so that you can set it with chattr, which will cause the ext4 driver to reallocate the file using extents instead of block lists. If you've converted an existing ext3 filesystem to ext4 (by using tune2fs to enable the new feature flags), you'll probably want to convert the existing files to use extents, and this is the way to do it.

Newly-created files on an ext4 filesystem always use extents (as far as I know), so if your filesystem was created as ext4 (as opposed to converted from ext3), everything should have the extent attribute already so you don't need to worry about it.

See this article for more information.