1

We cannot create more than 65000 sub-directories on a ext4 file systems and one suspicion we have is that the directory was created with an older version of ext4 or a different feature set.

I know how to find some basic information:

> stat .
  File: ‘.’
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d      Inode: 2           Links: 24
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2017-12-04 09:41:00.892098776 +0000
Modify: 2017-12-04 09:58:37.576216794 +0000
Change: 2017-12-04 09:58:37.576216794 +0000
 Birth: -

I'm interested in the more detailed ext4 flags, e.g. if the directory is linear or hash-based.

How can we view the settings of the inode, e.g. the flags?

3

Use stat on the directory.

However you are actually hitting a limit of the file system and this can cause performance issues with your storage. The common solution is to partition your namespace in a more structured way, or, depending on what your requirements are, a more flexible filesystem such as xfs, zfs or btrfs.

| improve this answer | |
  • Thank you for your response. Unfortunately stat only shows very basic information. – Georg Schölly Dec 3 '17 at 21:24
  • +1 for just getting rid of ext4 and using a filesystem which actually meets your needs. – Michael Hampton Dec 4 '17 at 3:19
  • @MichaelHampton: I think ext4 still meets our needs. If we didn't upgrade from ext3 it would support unlimited subdirectories by default. The fs you mentioned do have advantages over ext4 (such as snapshots, checksums, ...), but unlimited subdirectories is not one of them. Do you have any bad experience using ext4? I'm not against changing the FS if that would benefit us. – Georg Schölly Dec 4 '17 at 10:05
  • Try tune2fs on the mount. – Simon Greenwood Dec 4 '17 at 11:18
1

With the tool debugfs I was able to extract some more information:

> sudo debugfs /dev/sda1
> stat /
Inode: 2   Type: directory    Mode:  0755   Flags: 0x80000
Generation: 0    Version: 0x00000000:0000002f
User:     0   Group:     0   Size: 4096
File ACL: 0    Directory ACL: 0
Links: 25   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x5a2520d3:c43db60c -- Mon Dec  4 10:17:55 2017
 atime: 0x5a2520fb:98591bd8 -- Mon Dec  4 10:18:35 2017
 mtime: 0x5a2520d3:c43db60c -- Mon Dec  4 10:17:55 2017
 crtime: 0x59f78ef9:00000000 -- Mon Oct 30 20:43:37 2017
Size of extra inode fields: 28
EXTENTS:
(0):140

And for determining if a directory is linear or hash-based (I guess one could also parse the flags above):

> sudo debugfs /dev/sda1
> htree /
htree: Not a hash-indexed directory
| improve this answer | |

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.