[LEDE-DEV] [PATCH] include: image.mk: ext4: double the default inode counter

Felix Fietkau nbd at nbd.name
Tue Nov 22 08:42:06 PST 2016


On 2016-11-22 15:41, David Lang wrote:
> changing the blocksize doesn't really address the problem of too few inodes, 
> except indirectly in that the default number of inodes is calculated from the 
> number of blocks on the filesystem.
> 
> In the case of LEDE, we tend to have fewer large files on the ext4 partition 
> than most distros, for a couple of reasons. First we are always concerned with 
> space, so we tend to have smaller files to start with, and then we tend to have 
> most of the larger files in a system on jffs2/squashfs with ext4 being used only 
> to track the config files (which tend to be tiny)
> 
> Setting these involve trade-offs that don't matter much at the typical desktop 
> drive size, but matter a lot when space is really tight.
> 
> on a 16M filesystem, 1024 inodes means that you are assuming that your average 
> file size is going to be ~16K, that's larger than what we are going to use on an 
> overlay filesystem. with a 4K block size, your minimum filesize is effectivly 4K
> 
> However, on a very large filesystem, you are probably going to be filling that 
> space with large files (audio files at multiple MB each, video files at multiple 
> GB each, iso images at multiple GB, etc), so having a small blocksize and an 
> inode for every 4K of disk space ends up wasting a fair amount of space (a 4T 
> filesystem with one inode per 4K block uses 128GB just in inodes)
> 
> 
> Having gone through all of this, I think we need to step back a bit and change 
> the kconfig settings.
> 
> Instead of specifying blocksize by default, we should have a 'useage pattern' 
> for the filesystem (lots of small files, default, large files, gigantic files, 
> custom) and set the filesystem blocksize based on the combination of the usage 
> pattern and the filesystem size.
> 
> mkfs.ext* has the -T flag to specify usage type (lots of small files, default, 
> lots of large file, gigantic files) to set the blocksize and number of inodes on 
> the filesystem. The definitions are in /etc/mke2fs.conf
> 
> We should leverage this (and possibly add our own definitions)
> 
> On a 16M filesystem, we probably want to use a 1K block size and have an inode 
> for every couple of blocks.
I'd say on a 16M filesystem we probably want to use squashfs+ext4
instead of plain ext4 and avoid the inode issue altogether.

- Felix




More information about the Lede-dev mailing list