1

How can I use ext4's inline_data feature to store empty directories? It seems like inline_data works only with small files, or the directories store a lot of data.

1

You need e2fsprogs 1.43 or later, and you need to create a file system with the inline_data feature enabled, and inodes with at least 256 bytes:

mke2fs -t ext4 -O inline_data ...

(if mke2fs complains about the inodes being too small, add -I 256).

Directories will then use inline data transparently, as long as the data they need to store fits inside their inode. debugfs’s stat command will show inode data which looks like

Inode: 12   Type: directory    Mode:  0755   Flags: 0x10000000
Generation: 3089239889    Version: 0x00000000:00000002
User:     0   Group:     0   Size: 60
File ACL: 0    Directory ACL: 0
Links: 3   Blockcount: 0
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
 atime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
 mtime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
crtime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
Size of extra inode fields: 32
Extended attributes:
  system.data (0)
Inode checksum: 0x68fa51fe
Size of inline data: 60

This is for a directory containing one other directory; as you can see, it stores 60 bytes of inline data and has no extent.

  • Note that ext4 does not shrink directories, so inline_data is only used for small files and dies until they grow larger than will fit into the inode. – LustreOne Oct 21 '18 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.