12

I'd like to know if there's some rule (or formula) I can apply to find out how much of disk space will be used by the filesystem in an ext4 partition. for example, in a partition of 100 GB, how much can I actually use? does it depend on other parameters like inode size, etc?

1
  • I think it mostly depends on your inode count and the amount of metadata. One could in theory encode all data in directory structure and use just lots of zero byte files but the file system obviously would not take zero bytes to store those zero byte files. Ext4 supports extended attributes which can contain practically unlimited metadata attached to any single file. May 7, 2020 at 8:49

3 Answers 3

13

I don't know if it applies to you, but just in case: most of the time the huge majority of the apparent overhead of ext2/3/4 will be due to the default significant amount of reserved blocks for root. Make sure you specify -m 0 (or 1) to mkfs.ext4 when creating the filesystem or to tune2fs if adjusting it afterwards. The default is 5, which stands for 5% of total blocks and can be excessive in most cases.

2
  • 5
    The reserved space serves two purposes: to lower the fragmentation chances and to have some space for fsck. I do not recommend to make it 0. Sep 12, 2011 at 20:00
  • 2
    Unless one is speaking about storing some archival content which never changes, filling filesystem to brim will cause major performance problems in long run. Fragmentation and probability of random out-of-disk problems will be your first signs. Using 5% might be too high on really big filesystems, though. The inode structures will cause ~1.6% overhead in any case so in best case you should expect to use ~95% of raw block storage. For best performance, targeting closer to 80% would make sense. May 7, 2020 at 8:46
9

The most significant overhead comes from the inode tables, so it obviously depends on how many inodes you allocate. With the default options, every 128mb of disk gets 2 mb ( 8192 x 256 bytes each ) of inodes, or 1.6% overhead.

1
  • Indeed, increasing the mkfs.ext4 -i ... amount (inode ratio) made the number of inodes smaller, and thus made the free space reported by df --block-size=1 larger.
    – pts
    Jun 28, 2021 at 21:12
2

Difficult question to answer this as the amount of DATA space would vary with the number of files, their size, ACLs, Root reserved space, blocksize etc. There is not really a easily fixed answer to this question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .